package model
import "go.mongodb.org/mongo-driver/mongo/model"
Index ¶
- Constants
- type Addr
- type Cluster
- type ClusterDiff
- type ClusterKind
- type Conn
- type FSM
- type Range
- func NewRange(min int32, max int32) Range
- func (r *Range) Includes(i int32) bool
- func (r *Range) String() string
- type Server
- func BuildServer(addr Addr, isMasterResult *internal.IsMasterResult, buildInfoResult *internal.BuildInfoResult) *Server
- func (i *Server) SetAverageRTT(rtt time.Duration)
- type ServerKind
- type Tag
- type TagSet
- func NewTagSetFromMap(m map[string]string) TagSet
- func NewTagSetsFromMaps(maps []map[string]string) []TagSet
- func (ts TagSet) Contains(name, value string) bool
- func (ts TagSet) ContainsAll(other []Tag) bool
- type Version
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.
Types ¶
type Addr ¶
type Addr string
Addr is the address of a mongodb server.
func (Addr) Canonicalize ¶
Canonicalize creates a canonicalized address.
func (Addr) Network ¶
Network returns the network of the address.
func (Addr) String ¶
String returns the canonical version of the address.
type Cluster ¶
type Cluster struct { Servers []*Server Kind ClusterKind }
Cluster is a description of a cluster.
func (*Cluster) Server ¶
Server returns the model.Server with the specified address.
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 Conn ¶
Conn is a description of a connection.
type FSM ¶
FSM is a finite state machine for transitioning cluster states.
func NewFSM ¶
func NewFSM() *FSM
NewFSM creates a new FSM.
func (*FSM) Apply ¶
Apply uses the server model to transition states.
type Range ¶
Range is an inclusive range between 2 uint32.
func NewRange ¶
NewRange creates a new Range given a min and a max.
func (*Range) Includes ¶
Includes returns a bool indicating whether the supplied integer is included in the range.
func (*Range) String ¶
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 Tag ¶
Tag is a name/value pair.
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) Contains ¶
Contains indicates whether the name/value pair exists in the tag set.
func (TagSet) ContainsAll ¶
ContainsAll indicates whether all the name/value pairs exist in the tag set.
type Version ¶
Version represents a software version.
func (*Version) AtLeast ¶
AtLeast ensures that the version is at least as large as the "other" version.
func (*Version) String ¶
String provides the string representation of the Version.
Source Files ¶
addr.go cluster.go conn.go diff.go fsm.go kind.go range.go server.go tag.go version.go
- Version
- v0.0.2
- Published
- Mar 6, 2018
- Platform
- linux/amd64
- Imports
- 9 packages
- Last checked
- 3 minutes ago –
Tools for package owners.