Documentation
¶
Index ¶
Constants ¶
const Unknown = 0
Unknown is an unknown server or topology kind.
const UnknownStr = "Unknown"
UnknownStr represents an unknown server kind.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SelectedServer ¶
type SelectedServer struct {
Server
Kind TopologyKind
}
SelectedServer augments the Server type by also including the TopologyKind of the topology that includes the server. This type should be used to track the state of a server that was selected to perform an operation.
type Server ¶
type Server struct {
Addr address.Address
Arbiters []string
AverageRTT time.Duration
AverageRTTSet bool
Compression []string // compression methods returned by server
CanonicalAddr address.Address
ElectionID bson.ObjectID
HeartbeatInterval time.Duration
HelloOK bool
Hosts []string
IsCryptd bool
LastError error
LastUpdateTime time.Time
LastWriteTime time.Time
MaxBatchCount uint32
MaxDocumentSize uint32
MaxMessageSize uint32
Members []address.Address
Passives []string
Passive bool
Primary address.Address
ReadOnly bool
ServiceID *bson.ObjectID // Only set for servers that are deployed behind a load balancer.
SessionTimeoutMinutes *int64
SetName string
SetVersion uint32
Tags tag.Set
TopologyVersion *TopologyVersion
Kind ServerKind
WireVersion *VersionRange
}
Server contains information about a node in a cluster. This is created from hello command responses. If the value of the Kind field is LoadBalancer, only the Addr and Kind fields will be set. All other fields will be set to the zero value of the field's type.
type ServerKind ¶
type ServerKind uint32
ServerKind represents the type of a single server in a topology.
const ( ServerKindStandalone ServerKind = 1 ServerKindRSMember ServerKind = 2 ServerKindRSPrimary ServerKind = 4 + ServerKindRSMember ServerKindRSSecondary ServerKind = 8 + ServerKindRSMember ServerKindRSArbiter ServerKind = 16 + ServerKindRSMember ServerKindRSGhost ServerKind = 32 + ServerKindRSMember ServerKindMongos ServerKind = 256 ServerKindLoadBalancer ServerKind = 512 )
These constants are the possible types of servers.
func (ServerKind) String ¶
func (kind ServerKind) String() string
String returns a stringified version of the kind or "Unknown" if the kind is invalid.
type ServerSelector ¶
ServerSelector is an interface implemented by types that can perform server selection given a topology description and list of candidate servers. The selector should filter the provided candidates list and return a subset that matches some criteria.
type Topology ¶
type Topology struct {
Servers []Server
SetName string
Kind TopologyKind
SessionTimeoutMinutes *int64
CompatibilityErr error
}
Topology contains information about a MongoDB cluster.
type TopologyKind ¶
type TopologyKind uint32
TopologyKind represents a specific topology configuration.
const ( TopologyKindSingle TopologyKind = 1 TopologyKindReplicaSet TopologyKind = 2 TopologyKindReplicaSetNoPrimary TopologyKind = 4 + TopologyKindReplicaSet TopologyKindReplicaSetWithPrimary TopologyKind = 8 + TopologyKindReplicaSet TopologyKindSharded TopologyKind = 256 TopologyKindLoadBalanced TopologyKind = 512 )
These constants are the available topology configurations.
func (TopologyKind) String ¶
func (kind TopologyKind) String() string
String implements the fmt.Stringer interface.
type TopologyVersion ¶
TopologyVersion represents a software version.
Source Files
¶
- server.go
- topology.go