Skip to content

Commit ae932d3

Browse files
committed
delete util.go
1 parent c896cbe commit ae932d3

File tree

4 files changed

+9
-64
lines changed

4 files changed

+9
-64
lines changed

cmd/mongodb-healthcheck/healthcheck/health.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func HealthCheckMongodLiveness(ctx context.Context, cnf *db.Config, startupDelay
7373
return nil, errors.Wrap(err, "get isMaster response")
7474
}
7575

76-
rsStatus, err := getStatus(ctx, client)
76+
rsStatus, err := client.RSStatus(ctx)
7777
if err != nil {
7878
if err.Error() == ErrNoReplsetConfigStr {
7979
state := mongo.MemberStateUnknown
@@ -119,14 +119,7 @@ type OplogRs struct {
119119
StorageSize int64 `bson:"storageSize" json:"storageSize"`
120120
}
121121

122-
type ReplSetStatus struct {
123-
InitialSyncStatus InitialSyncStatus `bson:"initialSyncStatus" json:"initialSyncStatus"`
124-
mongo.Status `bson:",inline"`
125-
}
126-
127-
type InitialSyncStatus interface{}
128-
129-
func CheckState(rs ReplSetStatus, startupDelaySeconds int64, oplogSize int64) error {
122+
func CheckState(rs mongo.Status, startupDelaySeconds int64, oplogSize int64) error {
130123
if rs.GetSelf() == nil {
131124
return errors.New("invalid replset status")
132125
}

cmd/mongodb-healthcheck/healthcheck/readiness.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func MongodReadinessCheck(ctx context.Context, cnf *db.Config) error {
4444
return err
4545
}
4646

47-
s, err := func() (*ReplSetStatus, error) {
47+
s, err := func() (*mongo.Status, error) {
4848
cnf.Timeout = time.Second
4949
client, err := db.Dial(ctx, cnf)
5050
if err != nil {
@@ -55,7 +55,7 @@ func MongodReadinessCheck(ctx context.Context, cnf *db.Config) error {
5555
err = errors.Wrap(derr, "failed to disconnect")
5656
}
5757
}()
58-
rs, err := getStatus(ctx, client)
58+
rs, err := client.RSStatus(ctx)
5959
if err != nil {
6060
return nil, err
6161
}

cmd/mongodb-healthcheck/healthcheck/util.go

Lines changed: 0 additions & 51 deletions
This file was deleted.

pkg/psmdb/mongo/models.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ type IsMasterResp struct {
136136
}
137137

138138
type Status struct {
139+
InitialSyncStatus any `bson:"initialSyncStatus" json:"initialSyncStatus"`
139140
Set string `bson:"set" json:"set"`
140141
Date time.Time `bson:"date" json:"date"`
141142
MyState MemberState `bson:"myState" json:"myState"`
@@ -188,8 +189,10 @@ type StatusOptimes struct {
188189
DurableOptime *Optime `bson:"durableOpTime" json:"durableOpTime"`
189190
}
190191

191-
type MemberHealth int
192-
type MemberState int
192+
type (
193+
MemberHealth int
194+
MemberState int
195+
)
193196

194197
const (
195198
MemberHealthDown MemberHealth = iota

0 commit comments

Comments
 (0)