Versions in this module Expand all Collapse all v3 v3.4.4 Mar 18, 2020 Changes in this version + var ErrElectionNoLeader = errors.New("election: no leader") + var ErrElectionNotLeader = errors.New("election: not leader") + func NewLocker(s *Session, pfx string) sync.Locker + func NewSTM(c *v3.Client, apply func(STM) error, so ...stmOption) (*v3.TxnResponse, error) + func NewSTMReadCommitted(ctx context.Context, c *v3.Client, apply func(STM) error) (*v3.TxnResponse, error) + func NewSTMRepeatable(ctx context.Context, c *v3.Client, apply func(STM) error) (*v3.TxnResponse, error) + func NewSTMSerializable(ctx context.Context, c *v3.Client, apply func(STM) error) (*v3.TxnResponse, error) + func WithAbortContext(ctx context.Context) stmOption + func WithIsolation(lvl Isolation) stmOption + func WithPrefetch(keys ...string) stmOption + type Election struct + func NewElection(s *Session, pfx string) *Election + func ResumeElection(s *Session, pfx string, leaderKey string, leaderRev int64) *Election + func (e *Election) Campaign(ctx context.Context, val string) error + func (e *Election) Header() *pb.ResponseHeader + func (e *Election) Key() string + func (e *Election) Leader(ctx context.Context) (*v3.GetResponse, error) + func (e *Election) Observe(ctx context.Context) <-chan v3.GetResponse + func (e *Election) Proclaim(ctx context.Context, val string) error + func (e *Election) Resign(ctx context.Context) (err error) + func (e *Election) Rev() int64 + type Isolation int + const ReadCommitted + const RepeatableReads + const Serializable + const SerializableSnapshot + type Mutex struct + func NewMutex(s *Session, pfx string) *Mutex + func (m *Mutex) Header() *pb.ResponseHeader + func (m *Mutex) IsOwner() v3.Cmp + func (m *Mutex) Key() string + func (m *Mutex) Lock(ctx context.Context) error + func (m *Mutex) Unlock(ctx context.Context) error + type STM interface + Del func(key string) + Get func(key ...string) string + Put func(key, val string, opts ...v3.OpOption) + Rev func(key string) int64 + type Session struct + func NewSession(client *v3.Client, opts ...SessionOption) (*Session, error) + func (s *Session) Client() *v3.Client + func (s *Session) Close() error + func (s *Session) Done() <-chan struct{} + func (s *Session) Lease() v3.LeaseID + func (s *Session) Orphan() + type SessionOption func(*sessionOptions) + func WithContext(ctx context.Context) SessionOption + func WithLease(leaseID v3.LeaseID) SessionOption + func WithTTL(ttl int) SessionOption