Documentation
¶
Overview ¶
Package zookeeper contains the ZooKeeper store implementation.
Index ¶
- Constants
- func New(_ context.Context, endpoints []string, options *Config) (store.Store, error)
- type Config
- type Store
- func (s *Store) AtomicDelete(_ context.Context, key string, previous *store.KVPair) (bool, error)
- func (s *Store) AtomicPut(_ context.Context, key string, value []byte, previous *store.KVPair, ...) (bool, *store.KVPair, error)
- func (s *Store) Close() error
- func (s *Store) Delete(_ context.Context, key string) error
- func (s *Store) DeleteTree(_ context.Context, directory string) error
- func (s *Store) Exists(_ context.Context, key string, _ *store.ReadOptions) (bool, error)
- func (s *Store) Get(_ context.Context, key string, _ *store.ReadOptions) (pair *store.KVPair, err error)
- func (s *Store) List(ctx context.Context, directory string, opts *store.ReadOptions) ([]*store.KVPair, error)
- func (s *Store) NewLock(_ context.Context, key string, opts *store.LockOptions) (lock store.Locker, err error)
- func (s *Store) Put(ctx context.Context, key string, value []byte, opts *store.WriteOptions) error
- func (s *Store) Watch(ctx context.Context, key string, _ *store.ReadOptions) (<-chan *store.KVPair, error)
- func (s *Store) WatchTree(ctx context.Context, directory string, opts *store.ReadOptions) (<-chan []*store.KVPair, error)
Constants ¶
const (
// SOH control character.
SOH = "\x01"
)
const StoreName = "zookeeper"
StoreName the name of the store.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { ConnectionTimeout time.Duration Username string Password string MaxBufferSize int }
Config the Zookeeper configuration.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store implements the store.Store interface.
func (*Store) AtomicDelete ¶
AtomicDelete deletes a value at "key" if the key has not been modified in the meantime, throws an error if this is the case.
func (*Store) AtomicPut ¶
func (s *Store) AtomicPut(_ context.Context, key string, value []byte, previous *store.KVPair, _ *store.WriteOptions) (bool, *store.KVPair, error)
AtomicPut puts a value at "key" if the key has not been modified in the meantime, throws an error if this is the case.
func (*Store) DeleteTree ¶
DeleteTree deletes a range of keys under a given directory.
func (*Store) Get ¶
func (s *Store) Get(_ context.Context, key string, _ *store.ReadOptions) (pair *store.KVPair, err error)
Get the value at "key". Returns the last modified index to use in conjunction to Atomic calls.
func (*Store) List ¶
func (s *Store) List(ctx context.Context, directory string, opts *store.ReadOptions) ([]*store.KVPair, error)
List child nodes of a given directory.
func (*Store) NewLock ¶
func (s *Store) NewLock(_ context.Context, key string, opts *store.LockOptions) (lock store.Locker, err error)
NewLock returns a handle to a lock struct which can be used to provide mutual exclusion on a key.
func (*Store) Watch ¶
func (s *Store) Watch(ctx context.Context, key string, _ *store.ReadOptions) (<-chan *store.KVPair, error)
Watch for changes on a "key". It returns a channel that will receive changes or pass on errors. Upon creation, the current value will first be sent to the channel. Providing a non-nil stopCh can be used to stop watching.
func (*Store) WatchTree ¶
func (s *Store) WatchTree(ctx context.Context, directory string, opts *store.ReadOptions) (<-chan []*store.KVPair, error)
WatchTree watches for changes on a "directory". It returns a channel that will receive changes or pass on errors. Upon creating a watch, the current children values will be sent to the channel. Providing a non-nil stopCh can be used to stop watching.