Documentation ¶
Index ¶
Constants ¶
const UUIDSubtype byte = 4
UUIDSubtype is the BSON binary subtype that a UUID should be encoded as
Variables ¶
var ErrSessionEnded = errors.New("ended session was used")
ErrSessionEnded is returned when a client session is used after a call to endSession().
Functions ¶
Types ¶
type Client ¶
type Client struct { ClientID uuid.UUID ClusterTime *bson.Document Consistent bool // causal consistency OperationTime *bson.Timestamp SessionID *bson.Document SessionType Type Terminated bool // contains filtered or unexported fields }
Client is a session for clients to run commands.
func NewClientSession ¶
func NewClientSession(pool *Pool, clientID uuid.UUID, sessionType Type, opts ...ClientOptioner) (*Client, error)
NewClientSession creates a Client.
func (*Client) AdvanceClusterTime ¶
AdvanceClusterTime updates the session's cluster time.
func (*Client) AdvanceOperationTime ¶ added in v0.0.11
AdvanceOperationTime updates the session's operation time.
func (*Client) UpdateUseTime ¶
UpdateUseTime updates the session's last used time. Must be called whenver this session is used to send a command to the server.
type ClientOptioner ¶ added in v0.0.11
ClientOptioner is the interface implemented by types that can be used as options for configuring a client session.
type ClusterClock ¶
type ClusterClock struct {
// contains filtered or unexported fields
}
ClusterClock represents a logical clock for keeping track of cluster time.
func (*ClusterClock) AdvanceClusterTime ¶
func (cc *ClusterClock) AdvanceClusterTime(clusterTime *bson.Document)
AdvanceClusterTime updates the cluster's current time.
func (*ClusterClock) GetClusterTime ¶
func (cc *ClusterClock) GetClusterTime() *bson.Document
GetClusterTime returns the cluster's current time.
type Node ¶
type Node struct { *Server // contains filtered or unexported fields }
Node represents a server session in a linked list
type OptCausalConsistency ¶ added in v0.0.11
type OptCausalConsistency bool
OptCausalConsistency specifies if a session should be causally consistent.
func (OptCausalConsistency) Option ¶ added in v0.0.11
func (opt OptCausalConsistency) Option(c *Client) error
Option implements the ClientOptioner interface.
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool is a pool of server sessions that can be reused.
func NewPool ¶
func NewPool(descChan <-chan description.Topology) *Pool
NewPool creates a new server session pool
func (*Pool) CheckedOut ¶
CheckedOut returns number of sessions checked out from pool.
func (*Pool) GetSession ¶
GetSession retrieves an unexpired session from the pool.
func (*Pool) ReturnSession ¶
ReturnSession returns a session to the pool if it has not expired.