Documentation ¶
Index ¶
Constants ¶
const Unknown = 0
Unknown is an unknown cluster or server kind.
const UnsetRTT = -1 * time.Millisecond
UnsetRTT is the unset value for a round trip time.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Addr ¶
type Addr string
Addr is the address of a mongodb server.
func (Addr) Canonicalize ¶
Canonicalize creates a canonicalized address.
type Cluster ¶
type Cluster struct { Servers []*Server Kind ClusterKind }
Cluster is a description of a cluster.
type ClusterDiff ¶
ClusterDiff is the difference between two clusters.
func DiffCluster ¶
func DiffCluster(old, new *Cluster) *ClusterDiff
DiffCluster returns the difference of two clusters.
type ClusterKind ¶
type ClusterKind uint32
ClusterKind represents a type of the cluster.
const ( Single ClusterKind = 1 ReplicaSet ClusterKind = 2 ReplicaSetNoPrimary ClusterKind = 4 + ReplicaSet ReplicaSetWithPrimary ClusterKind = 8 + ReplicaSet Sharded ClusterKind = 256 )
ClusterKind constants.
func (ClusterKind) String ¶
func (kind ClusterKind) String() string
type Range ¶
Range is an inclusive range between 2 uint32.
type Server ¶
type Server struct { Addr Addr AverageRTT time.Duration AverageRTTSet bool CanonicalAddr Addr ElectionID objectid.ObjectID GitVersion string HeartbeatInterval time.Duration LastError error LastUpdateTime time.Time LastWriteTime time.Time MaxBatchCount uint16 MaxDocumentSize uint32 MaxMessageSize uint32 Members []Addr ReadOnly bool SetName string SetVersion uint32 Tags TagSet Kind ServerKind WireVersion *Range Version Version }
Server is a description of a server.
func BuildServer ¶
func BuildServer(addr Addr, isMasterResult *internal.IsMasterResult, buildInfoResult *internal.BuildInfoResult) *Server
BuildServer builds a server.Server from an endpoint, IsMasterResult, and a BuildInfoResult.
func (*Server) SetAverageRTT ¶
SetAverageRTT sets the average round trip time.
type ServerKind ¶
type ServerKind uint32
ServerKind represents a type of server.
const ( Standalone ServerKind = 1 RSMember ServerKind = 2 RSPrimary ServerKind = 4 + RSMember RSSecondary ServerKind = 8 + RSMember RSArbiter ServerKind = 16 + RSMember RSGhost ServerKind = 32 + RSMember Mongos ServerKind = 256 )
ServerKind constants.
func (ServerKind) String ¶
func (kind ServerKind) String() string
type TagSet ¶
type TagSet []Tag
TagSet is an ordered list of Tags.
func NewTagSetFromMap ¶
NewTagSetFromMap creates a new tag set from a map.
func NewTagSetsFromMaps ¶
NewTagSetsFromMaps creates new tag sets from maps.
func (TagSet) ContainsAll ¶
ContainsAll indicates whether all the name/value pairs exist in the tag set.