Documentation ¶
Overview ¶
Package sync is an interface for distributed synchronization
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrLockTimeout = errors.New("lock timeout")
ErrLockTimeout error
Functions ¶
This section is empty.
Types ¶
type Leader ¶
type Leader interface { // resign leadership Resign() error // status returns when leadership is lost Status() chan bool }
Leader provides leadership election
type LockOptions ¶
LockOptions holds the lock options
type Options ¶
type Options struct { // Logger used for logging Logger logger.Logger // Tracer used for tracing Tracer tracer.Tracer // Meter used for merics Meter meter.Meter // Prefix holds prefix? Prefix string // Nodes holds the nodes // TODO: change to Addrs ? Nodes []string }
Options holds the sync options
func NewOptions ¶
NewOptions returns options that filled by opts
type Sync ¶
type Sync interface { // Initialise options Init(...Option) error // Return the options Options() Options // Elect a leader Leader(id string, opts ...LeaderOption) (Leader, error) // Lock acquires a lock Lock(id string, opts ...LockOption) error // Unlock releases a lock Unlock(id string) error // Sync implementation String() string }
Sync is an interface for distributed synchronization
Click to show internal directories.
Click to hide internal directories.