@@ -23,15 +23,15 @@ func (fsm *monitorFSM) apply(d *desc.Server) {
23
23
copy (newServers , fsm .Servers )
24
24
25
25
fsm .Cluster = desc.Cluster {
26
- ClusterType : fsm .ClusterType ,
27
- Servers : newServers ,
26
+ Type : fsm .Type ,
27
+ Servers : newServers ,
28
28
}
29
29
30
30
if _ , ok := fsm .findServer (d .Endpoint ); ! ok {
31
31
return
32
32
}
33
33
34
- switch fsm .ClusterType {
34
+ switch fsm .Type {
35
35
case desc .UnknownClusterType :
36
36
fsm .applyToUnknownClusterType (d )
37
37
case desc .Sharded :
@@ -46,7 +46,7 @@ func (fsm *monitorFSM) apply(d *desc.Server) {
46
46
}
47
47
48
48
func (fsm * monitorFSM ) applyToReplicaSetNoPrimary (d * desc.Server ) {
49
- switch d .ServerType {
49
+ switch d .Type {
50
50
case desc .Standalone , desc .Mongos :
51
51
fsm .removeServerByEndpoint (d .Endpoint )
52
52
case desc .RSPrimary :
@@ -59,7 +59,7 @@ func (fsm *monitorFSM) applyToReplicaSetNoPrimary(d *desc.Server) {
59
59
}
60
60
61
61
func (fsm * monitorFSM ) applyToReplicaSetWithPrimary (d * desc.Server ) {
62
- switch d .ServerType {
62
+ switch d .Type {
63
63
case desc .Standalone , desc .Mongos :
64
64
fsm .removeServerByEndpoint (d .Endpoint )
65
65
fsm .checkIfHasPrimary ()
@@ -74,7 +74,7 @@ func (fsm *monitorFSM) applyToReplicaSetWithPrimary(d *desc.Server) {
74
74
}
75
75
76
76
func (fsm * monitorFSM ) applyToShardedClusterType (d * desc.Server ) {
77
- switch d .ServerType {
77
+ switch d .Type {
78
78
case desc .Mongos , desc .UnknownServerType :
79
79
fsm .replaceServer (d )
80
80
case desc .Standalone , desc .RSPrimary , desc .RSSecondary , desc .RSArbiter , desc .RSMember , desc .RSGhost :
@@ -83,7 +83,7 @@ func (fsm *monitorFSM) applyToShardedClusterType(d *desc.Server) {
83
83
}
84
84
85
85
func (fsm * monitorFSM ) applyToSingle (d * desc.Server ) {
86
- switch d .ServerType {
86
+ switch d .Type {
87
87
case desc .UnknownServerType :
88
88
fsm .replaceServer (d )
89
89
case desc .Standalone , desc .Mongos :
@@ -104,7 +104,7 @@ func (fsm *monitorFSM) applyToSingle(d *desc.Server) {
104
104
}
105
105
106
106
func (fsm * monitorFSM ) applyToUnknownClusterType (d * desc.Server ) {
107
- switch d .ServerType {
107
+ switch d .Type {
108
108
case desc .Mongos :
109
109
fsm .setType (desc .Sharded )
110
110
fsm .replaceServer (d )
@@ -246,7 +246,7 @@ func (fsm *monitorFSM) addServer(endpoint desc.Endpoint) {
246
246
247
247
func (fsm * monitorFSM ) findPrimary () (int , bool ) {
248
248
for i , s := range fsm .Servers {
249
- if s .ServerType == desc .RSPrimary {
249
+ if s .Type == desc .RSPrimary {
250
250
return i , true
251
251
}
252
252
}
@@ -287,5 +287,5 @@ func (fsm *monitorFSM) setServer(i int, d *desc.Server) {
287
287
}
288
288
289
289
func (fsm * monitorFSM ) setType (clusterType desc.ClusterType ) {
290
- fsm .ClusterType = clusterType
290
+ fsm .Type = clusterType
291
291
}
0 commit comments