| 1 | // Copyright (C) MongoDB, Inc. 2017-present. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 | // not use this file except in compliance with the License. You may obtain |
| 5 | // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 |
| 6 | |
| 7 | package descriptionscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/description`/ |
| 8 | |
| 9 | // ServerKind represents the type of a single server in a topology. |
| 10 | type ServerKindscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/description`/ServerKind# uint32 |
| 11 | |
| 12 | // These constants are the possible types of servers. |
| 13 | const ( |
| 14 | Standalonescip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/description`/Standalone. ServerKindscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/description`/ServerKind# = 1 |
| 15 | RSMemberscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/description`/RSMember. ServerKindscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/description`/ServerKind# = 2 |
| 16 | RSPrimaryscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/description`/RSPrimary. ServerKindscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/description`/ServerKind# = 4 + RSMemberscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/description`/RSMember. |
| 17 | RSSecondaryscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/description`/RSSecondary. ServerKindscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/description`/ServerKind# = 8 + RSMemberscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/description`/RSMember. |
| 18 | RSArbiterscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/description`/RSArbiter. ServerKindscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/description`/ServerKind# = 16 + RSMemberscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/description`/RSMember. |
| 19 | RSGhostscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/description`/RSGhost. ServerKindscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/description`/ServerKind# = 32 + RSMemberscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/description`/RSMember. |
| 20 | Mongosscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/description`/Mongos. ServerKindscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/description`/ServerKind# = 256 |
| 21 | LoadBalancerscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/description`/LoadBalancer. ServerKindscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/description`/ServerKind# = 512 |
| 22 | ) |
| 23 | |
| 24 | // String returns a stringified version of the kind or "Unknown" if the kind is invalid. |
| 25 | func (kind ServerKindscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/description`/ServerKind#) Stringscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/description`/ServerKind#String().() string { |
| 26 | switch kind { |
| 27 | case Standalonescip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/description`/Standalone.: |
| 28 | return "Standalone" |
| 29 | case RSMemberscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/description`/RSMember.: |
| 30 | return "RSOther" |
| 31 | case RSPrimaryscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/description`/RSPrimary.: |
| 32 | return "RSPrimary" |
| 33 | case RSSecondaryscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/description`/RSSecondary.: |
| 34 | return "RSSecondary" |
| 35 | case RSArbiterscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/description`/RSArbiter.: |
| 36 | return "RSArbiter" |
| 37 | case RSGhostscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/description`/RSGhost.: |
| 38 | return "RSGhost" |
| 39 | case Mongosscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/description`/Mongos.: |
| 40 | return "Mongos" |
| 41 | case LoadBalancerscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/description`/LoadBalancer.: |
| 42 | return "LoadBalancer" |
| 43 | } |
| 44 | |
| 45 | return "Unknown" |
| 46 | } |