Versions in this module Expand all Collapse all v1 v1.4.1 Sep 27, 2020 Changes in this version + var ErrConnectionClosed = ConnectionError + var ErrPoolConnected = PoolError("attempted to Connect to an already connected pool") + var ErrPoolDisconnected = PoolError("attempted to check out a connection from closed connection pool") + var ErrServerClosed = errors.New("server is closed") + var ErrServerConnected = errors.New("server is connected") + var ErrServerSelectionTimeout = errors.New("server selection timeout") + var ErrSubscribeAfterClosed = errors.New("cannot subscribe after closeConnection") + var ErrTopologyClosed = errors.New("topology is closed") + var ErrTopologyConnected = errors.New("topology is connected or connecting") + var ErrWaitQueueTimeout = PoolError("timed out while checking out a connection from connection pool") + var ErrWrongPool = PoolError("connection does not belong to this pool") + type Connection struct + func (c *Connection) Address() address.Address + func (c *Connection) Alive() bool + func (c *Connection) Close() error + func (c *Connection) CompressWireMessage(src, dst []byte) ([]byte, error) + func (c *Connection) Description() description.Server + func (c *Connection) Expire() error + func (c *Connection) ID() string + func (c *Connection) LocalAddress() address.Address + func (c *Connection) ReadWireMessage(ctx context.Context, dst []byte) ([]byte, error) + func (c *Connection) WriteWireMessage(ctx context.Context, wm []byte) error + type ConnectionError struct + ConnectionID string + Wrapped error + func (e ConnectionError) Error() string + type ConnectionOption func(*connectionConfig) error + func WithAppName(fn func(string) string) ConnectionOption + func WithCompressors(fn func([]string) []string) ConnectionOption + func WithConnectTimeout(fn func(time.Duration) time.Duration) ConnectionOption + func WithDialer(fn func(Dialer) Dialer) ConnectionOption + func WithHandshaker(fn func(Handshaker) Handshaker) ConnectionOption + func WithIdleTimeout(fn func(time.Duration) time.Duration) ConnectionOption + func WithLifeTimeout(fn func(time.Duration) time.Duration) ConnectionOption + func WithMonitor(fn func(*event.CommandMonitor) *event.CommandMonitor) ConnectionOption + func WithReadTimeout(fn func(time.Duration) time.Duration) ConnectionOption + func WithTLSConfig(fn func(*tls.Config) *tls.Config) ConnectionOption + func WithWriteTimeout(fn func(time.Duration) time.Duration) ConnectionOption + func WithZlibLevel(fn func(*int) *int) ConnectionOption + type Dialer interface + DialContext func(ctx context.Context, network, address string) (net.Conn, error) + var DefaultDialer Dialer = &net.Dialer{} + type DialerFunc func(ctx context.Context, network, address string) (net.Conn, error) + func (df DialerFunc) DialContext(ctx context.Context, network, address string) (net.Conn, error) + type Handshaker = driver.Handshaker + type MonitorMode uint8 + const AutomaticMode + const SingleMode + type Option func(*config) error + func WithConnString(fn func(connstring.ConnString) connstring.ConnString) Option + func WithMode(fn func(MonitorMode) MonitorMode) Option + func WithReplicaSetName(fn func(string) string) Option + func WithSeedList(fn func(...string) []string) Option + func WithServerOptions(fn func(...ServerOption) []ServerOption) Option + func WithServerSelectionTimeout(fn func(time.Duration) time.Duration) Option + type PoolError string + func (pe PoolError) Error() string + type SelectedServer struct + Kind description.TopologyKind + func (ss *SelectedServer) Description() description.SelectedServer + type Server struct + func ConnectServer(addr address.Address, updateCallback func(description.Server), ...) (*Server, error) + func NewServer(addr address.Address, opts ...ServerOption) (*Server, error) + func (s *Server) Connect(updateCallback func(description.Server)) error + func (s *Server) Connection(ctx context.Context) (driver.Connection, error) + func (s *Server) Description() description.Server + func (s *Server) Disconnect(ctx context.Context) error + func (s *Server) ProcessError(err error) + func (s *Server) RequestImmediateCheck() + func (s *Server) SelectedDescription() description.SelectedServer + func (s *Server) String() string + func (s *Server) Subscribe() (*ServerSubscription, error) + type ServerOption func(*serverConfig) error + func WithClock(fn func(clock *session.ClusterClock) *session.ClusterClock) ServerOption + func WithCompressionOptions(fn func(...string) []string) ServerOption + func WithConnectionOptions(fn func(...ConnectionOption) []ConnectionOption) ServerOption + func WithConnectionPoolMaxIdleTime(fn func(time.Duration) time.Duration) ServerOption + func WithConnectionPoolMonitor(fn func(*event.PoolMonitor) *event.PoolMonitor) ServerOption + func WithHeartbeatInterval(fn func(time.Duration) time.Duration) ServerOption + func WithHeartbeatTimeout(fn func(time.Duration) time.Duration) ServerOption + func WithMaxConnections(fn func(uint64) uint64) ServerOption + func WithMinConnections(fn func(uint64) uint64) ServerOption + func WithRegistry(fn func(*bsoncodec.Registry) *bsoncodec.Registry) ServerOption + type ServerSubscription struct + C <-chan description.Server + func (ss *ServerSubscription) Unsubscribe() error + type Subscription struct + C <-chan description.Topology + func (s *Subscription) Unsubscribe() error + type Topology struct + SessionPool *session.Pool + func New(opts ...Option) (*Topology, error) + func (t *Topology) Connect() error + func (t *Topology) Description() description.Topology + func (t *Topology) Disconnect(ctx context.Context) error + func (t *Topology) FindServer(selected description.Server) (*SelectedServer, error) + func (t *Topology) Kind() description.TopologyKind + func (t *Topology) RequestImmediateCheck() + func (t *Topology) SelectServer(ctx context.Context, ss description.ServerSelector) (driver.Server, error) + func (t *Topology) SelectServerLegacy(ctx context.Context, ss description.ServerSelector) (*SelectedServer, error) + func (t *Topology) String() string + func (t *Topology) Subscribe() (*Subscription, error) + func (t *Topology) SupportsRetryWrites() bool + func (t *Topology) SupportsSessions() bool