Versions in this module Expand all Collapse all v0 v0.0.2 Mar 6, 2018 v0.0.1 Feb 13, 2018 Changes in this version + var ErrClusterClosed = errors.New("cluster is closed") + func SelectServers(ctx context.Context, m *Monitor, selector ServerSelector) ([]*model.Server, error) + type Cluster struct + func New(opts ...Option) (*Cluster, error) + func NewWithMonitor(monitor *Monitor, opts ...Option) (*Cluster, error) + func (c *Cluster) Close() error + func (c *Cluster) Model() *model.Cluster + func (c *Cluster) SelectServer(ctx context.Context, selector ServerSelector, ...) (*ops.SelectedServer, error) + type Monitor struct + func StartMonitor(opts ...Option) (*Monitor, error) + func (m *Monitor) RequestImmediateCheck() + func (m *Monitor) ServerMonitor(addr model.Addr) (*server.Monitor, bool) + func (m *Monitor) Stop() + func (m *Monitor) Subscribe() (<-chan *model.Cluster, func(), error) + type MonitorMode uint8 + const AutomaticMode + const SingleMode + type Option func(*config) error + func WithConnString(cs connstring.ConnString) Option + func WithMode(mode MonitorMode) Option + func WithMoreServerOptions(opts ...server.Option) Option + func WithReplicaSetName(name string) Option + func WithSeedList(seedList ...string) Option + func WithServerOptions(opts ...server.Option) Option + type Server interface + Connection func(context.Context) (conn.Connection, error) + Model func() *model.Server + type ServerSelector func(*model.Cluster, []*model.Server) ([]*model.Server, error) + func CompositeSelector(selectors []ServerSelector) ServerSelector + func LatencySelector(latency time.Duration) ServerSelector + func WriteSelector() ServerSelector