Documentation
¶
Index ¶
- Variables
- func NewLocker(client *EtcdClient, key string) sync.Locker
- func NewSTM(client *EtcdClient, apply func(*STM) error) <-chan error
- func WaitEvents(c *EtcdClient, key string, rev int64, evs []storagepb.Event_EventType) (*storagepb.Event, error)
- func WaitPrefixEvents(c *EtcdClient, prefix string, rev int64, evs []storagepb.Event_EventType) (*storagepb.Event, error)
- type Barrier
- type EtcdClient
- type Mutex
- type PriorityQueue
- type Queue
- type RWMutex
- type Range
- func (r *Range) FirstCreate() (*pb.RangeResponse, error)
- func (r *Range) FirstKey() (*pb.RangeResponse, error)
- func (r *Range) FirstRev() (*pb.RangeResponse, error)
- func (r *Range) LastCreate() (*pb.RangeResponse, error)
- func (r *Range) LastKey() (*pb.RangeResponse, error)
- func (r *Range) LastRev() (*pb.RangeResponse, error)
- func (r *Range) OpenInterval() (*pb.RangeResponse, error)
- func (r *Range) Prefix() (*pb.RangeResponse, error)
- type RemoteKV
- func GetRemoteKV(client *EtcdClient, key string) (*RemoteKV, error)
- func NewKV(client *EtcdClient, key, val string, leaseID lease.LeaseID) (*RemoteKV, error)
- func NewKey(client *EtcdClient, key string, leaseID lease.LeaseID) (*RemoteKV, error)
- func NewSequentialKV(client *EtcdClient, prefix, val string) (*RemoteKV, error)
- func NewUniqueKV(client *EtcdClient, prefix string, val string, leaseID lease.LeaseID) (*RemoteKV, error)
- func NewUniqueKey(client *EtcdClient, prefix string) (*RemoteKV, error)
- type STM
- type Watcher
Constants ¶
This section is empty.
Variables ¶
var ( ErrKeyExists = errors.New("key already exists") ErrWaitMismatch = errors.New("unexpected wait result") )
Functions ¶
func NewSTM ¶
func NewSTM(client *EtcdClient, apply func(*STM) error) <-chan error
NewSTM creates new transaction loop for a given apply function.
func WaitEvents ¶
func WaitEvents(c *EtcdClient, key string, rev int64, evs []storagepb.Event_EventType) (*storagepb.Event, error)
WaitEvents waits on a key until it observes the given events and returns the final one.
func WaitPrefixEvents ¶
func WaitPrefixEvents(c *EtcdClient, prefix string, rev int64, evs []storagepb.Event_EventType) (*storagepb.Event, error)
Types ¶
type Barrier ¶
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 ¶
func NewBarrier(client *EtcdClient, key string) *Barrier
type EtcdClient ¶
type EtcdClient struct { KV pb.KVClient Lease pb.LeaseClient Watch pb.WatchClient // contains filtered or unexported fields }
func NewEtcdClient ¶
func NewEtcdClient(conn *grpc.ClientConn) *EtcdClient
type Mutex ¶
type Mutex struct {
// contains filtered or unexported fields
}
Mutex implements the sync Locker interface with etcd
func NewMutex ¶
func NewMutex(client *EtcdClient, key string) *Mutex
type PriorityQueue ¶
type PriorityQueue struct {
// contains filtered or unexported fields
}
PriorityQueue implements a multi-reader, multi-writer distributed queue.
func NewPriorityQueue ¶
func NewPriorityQueue(client *EtcdClient, key string) *PriorityQueue
NewPriorityQueue creates an etcd priority queue.
func (*PriorityQueue) Dequeue ¶
func (q *PriorityQueue) Dequeue() (string, error)
Dequeue returns Enqueued()'d items in FIFO order. If the queue is empty, Dequeue blocks until items are available.
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue implements a multi-reader, multi-writer distributed queue.
func NewQueue ¶
func NewQueue(client *EtcdClient, keyPrefix string) *Queue
type RWMutex ¶
type RWMutex struct {
// contains filtered or unexported fields
}
func NewRWMutex ¶
func NewRWMutex(client *EtcdClient, key string) *RWMutex
type Range ¶
type Range struct {
// contains filtered or unexported fields
}
func NewRange ¶
func NewRange(client *EtcdClient, key string) *Range
func NewRangeRev ¶
func NewRangeRev(client *EtcdClient, key string, rev int64) *Range
func (*Range) FirstCreate ¶
func (r *Range) FirstCreate() (*pb.RangeResponse, error)
func (*Range) LastCreate ¶
func (r *Range) LastCreate() (*pb.RangeResponse, error)
func (*Range) OpenInterval ¶
func (r *Range) OpenInterval() (*pb.RangeResponse, error)
OpenInterval gets the keys in the set <key>* - <key>
type RemoteKV ¶
type RemoteKV struct {
// contains filtered or unexported fields
}
Key is a key/revision pair created by the client and stored on etcd
func GetRemoteKV ¶
func GetRemoteKV(client *EtcdClient, key string) (*RemoteKV, error)
func NewSequentialKV ¶
func NewSequentialKV(client *EtcdClient, prefix, val string) (*RemoteKV, error)
NewSequentialKV allocates a new sequential key-value pair at <prefix>/nnnnn
func NewUniqueKV ¶
func NewUniqueKey ¶
func NewUniqueKey(client *EtcdClient, prefix string) (*RemoteKV, error)
type STM ¶
type STM struct {
// contains filtered or unexported fields
}
STM implements software transactional memory over etcd
func (*STM) Abort ¶
func (s *STM) Abort()
Abort abandons the apply loop, letting the transaction close without a commit.
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
func NewPrefixWatcher ¶
func NewPrefixWatcher(c *EtcdClient, prefix string, rev int64) (*Watcher, error)
func NewWatcher ¶
func NewWatcher(c *EtcdClient, key string, rev int64) (*Watcher, error)