etcd: github.com/coreos/etcd/contrib/recipes Index | Files

package recipe

import "github.com/coreos/etcd/contrib/recipes"

Package recipe contains experimental client-side distributed synchronization primitives.

Index

Package Files

barrier.go client.go doc.go double_barrier.go key.go priority_queue.go queue.go rwmutex.go watch.go

Variables

var (
    ErrKeyExists      = errors.New("key already exists")
    ErrWaitMismatch   = errors.New("unexpected wait result")
    ErrTooManyClients = errors.New("too many clients")
    ErrNoWatcher      = errors.New("no watcher channel")
)

func WaitEvents Uses

func WaitEvents(c *clientv3.Client, key string, rev int64, evs []mvccpb.Event_EventType) (*clientv3.Event, error)

WaitEvents waits on a key until it observes the given events and returns the final one.

func WaitPrefixEvents Uses

func WaitPrefixEvents(c *clientv3.Client, prefix string, rev int64, evs []mvccpb.Event_EventType) (*clientv3.Event, error)

type Barrier Uses

type Barrier struct {
    // contains filtered or unexported fields
}

Barrier creates a key in etcd to block processes, then deletes the key to release all blocked processes.

func NewBarrier Uses

func NewBarrier(client *v3.Client, key string) *Barrier

func (*Barrier) Hold Uses

func (b *Barrier) Hold() error

Hold creates the barrier key causing processes to block on Wait.

func (*Barrier) Release Uses

func (b *Barrier) Release() error

Release deletes the barrier key to unblock all waiting processes.

func (*Barrier) Wait Uses

func (b *Barrier) Wait() error

Wait blocks on the barrier key until it is deleted. If there is no key, Wait assumes Release has already been called and returns immediately.

type DoubleBarrier Uses

type DoubleBarrier struct {
    // contains filtered or unexported fields
}

DoubleBarrier blocks processes on Enter until an expected count enters, then blocks again on Leave until all processes have left.

func NewDoubleBarrier Uses

func NewDoubleBarrier(s *concurrency.Session, key string, count int) *DoubleBarrier

func (*DoubleBarrier) Enter Uses

func (b *DoubleBarrier) Enter() error

Enter waits for "count" processes to enter the barrier then returns

func (*DoubleBarrier) Leave Uses

func (b *DoubleBarrier) Leave() error

Leave waits for "count" processes to leave the barrier then returns

type EphemeralKV Uses

type EphemeralKV struct{ RemoteKV }

EphemeralKV is a new key associated with a session lease

type PriorityQueue Uses

type PriorityQueue struct {
    // contains filtered or unexported fields
}

PriorityQueue implements a multi-reader, multi-writer distributed queue.

func NewPriorityQueue Uses

func NewPriorityQueue(client *v3.Client, key string) *PriorityQueue

NewPriorityQueue creates an etcd priority queue.

func (*PriorityQueue) Dequeue Uses

func (q *PriorityQueue) Dequeue() (string, error)

Dequeue returns Enqueue()'d items in FIFO order. If the queue is empty, Dequeue blocks until items are available.

func (*PriorityQueue) Enqueue Uses

func (q *PriorityQueue) Enqueue(val string, pr uint16) error

Enqueue puts a value into a queue with a given priority.

type Queue Uses

type Queue struct {
    // contains filtered or unexported fields
}

Queue implements a multi-reader, multi-writer distributed queue.

func NewQueue Uses

func NewQueue(client *v3.Client, keyPrefix string) *Queue

func (*Queue) Dequeue Uses

func (q *Queue) Dequeue() (string, error)

Dequeue returns Enqueue()'d elements in FIFO order. If the queue is empty, Dequeue blocks until elements are available.

func (*Queue) Enqueue Uses

func (q *Queue) Enqueue(val string) error

type RWMutex Uses

type RWMutex struct {
    // contains filtered or unexported fields
}

func NewRWMutex Uses

func NewRWMutex(s *concurrency.Session, prefix string) *RWMutex

func (*RWMutex) Lock Uses

func (rwm *RWMutex) Lock() error

func (*RWMutex) RLock Uses

func (rwm *RWMutex) RLock() error

func (*RWMutex) RUnlock Uses

func (rwm *RWMutex) RUnlock() error

func (*RWMutex) Unlock Uses

func (rwm *RWMutex) Unlock() error

type RemoteKV Uses

type RemoteKV struct {
    // contains filtered or unexported fields
}

RemoteKV is a key/revision pair created by the client and stored on etcd

func (*RemoteKV) Delete Uses

func (rk *RemoteKV) Delete() error

func (*RemoteKV) Key Uses

func (rk *RemoteKV) Key() string

func (*RemoteKV) Put Uses

func (rk *RemoteKV) Put(val string) error

func (*RemoteKV) Revision Uses

func (rk *RemoteKV) Revision() int64

func (*RemoteKV) Value Uses

func (rk *RemoteKV) Value() string

Package recipe imports 8 packages (graph) and is imported by 2 packages. Updated 2018-07-30. Refresh now. Tools for package owners.