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")
)
Functions ¶
This section is empty.
Types ¶
type Leader ¶
type Leader interface { // Id leader node Id() string // Resign resigns leadership Resign() error // Observe watch leadership event Observe() chan ObserveResult // Status returns when leadership is lost Status() chan bool }
Leader provides leadership election
type LeaderOption ¶
type LeaderOption func(o *LeaderOptions)
func LeaderNS ¶ added in v0.22.4
func LeaderNS(ns string) LeaderOption
LeaderNS sets the leader namespace
func LeaderTTL ¶ added in v0.22.4
func LeaderTTL(t int64) LeaderOption
LeaderTTL sets the leader ttl
type LeaderOptions ¶
type ListMembersOption ¶ added in v0.22.3
type ListMembersOption func(o *ListMembersOptions)
func MemberNS ¶ added in v0.22.4
func MemberNS(ns string) ListMembersOption
MemberNS sets the list member namespace
type ListMembersOptions ¶ added in v0.22.3
type ListMembersOptions struct {
Namespace string
}
type LockOption ¶
type LockOption func(o *LockOptions)
type ObserveResult ¶ added in v1.4.8
type Sync ¶
type Sync interface { // Init Initialise options Init(...Option) error // Options Return the options Options() Options // Leader Elect a leader Leader(name string, opts ...LeaderOption) (Leader, error) // ListMembers get all election member ListMembers(opts ...ListMembersOption) ([]*Member, error) // Lock acquires a lock Lock(id string, opts ...LockOption) error // Unlock releases a lock Unlock(id string) error // String Sync implementation String() string }
Sync is an interface for distributed synchronization
Click to show internal directories.
Click to hide internal directories.