Documentation
¶
Index ¶
- Variables
- func CreateEndpoints(addrs []string, scheme string) (entries []string)
- func GetDirectory(key string) string
- func NewKey(separator string, pkgName string, tags ...string) keyMaker
- func Normalize(key string) string
- func SplitKey(key string) (path []string)
- type KeyValue
- type LockOption
- type LockOptions
- type Locker
- type PutOption
- type PutOptions
- type Store
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotSupported is returned when a method is not implemented/supported by the current backend ErrNotSupported = errors.New("not supported") // ErrKeyModified is returned during an atomic operation if the index does not match the one in the store ErrKeyModified = errors.New("key was modified") // ErrKeyNotFound is returned when the key is not found in the store during a Get operation ErrKeyNotFound = errors.New("key not found") // ErrKeyExists is returned when the previous value exists in the case of an AtomicPut ErrKeyExists = errors.New("key exists") // ErrUnableToLock is returned when there is an error when acquiring a lock on a key ErrUnableToLock = errors.New("failed to acquire the lock") )
Functions ¶
func CreateEndpoints ¶
CreateEndpoints creates a list of endpoints given the right scheme
Types ¶
type LockOption ¶
type LockOption func(*LockOptions)
func LockExpiration ¶
func LockExpiration(t time.Duration) LockOption
func LockValue ¶
func LockValue(value []byte) LockOption
func RenewLock ¶
func RenewLock(r chan struct{}) LockOption
type LockOptions ¶
type PutOptions ¶
type Store ¶
type Store interface { // Put a value with the specified key Put(key string, value []byte, opts ...PutOption) error // AtomicPut puts a single value and gets previous one if exists. // Pass previous = nil to create a new key. AtomicPut(key string, value []byte, expected *KeyValue, opts ...PutOption) (*KeyValue, error) // Get a value with given key Get(key string) (*KeyValue, error) // List the content with given prefix List(prefix string) ([]*KeyValue, error) // Delete the value with the specified key Delete(key string) error // Atomic delete of a single value AtomicDelete(key string, expected *KeyValue) (bool, error) // DeleteTree deletes a range of keys under a given prefix DeleteTree(prefix string) error // Exists checks if a key exists in the backend Exists(key string) (bool, error) // Watch for changes on a key Watch(key string, stopCh <-chan struct{}) (<-chan *KeyValue, error) // WatchTree watches for changes on child nodes under a given prefix WatchTree(prefix string, stopCh <-chan struct{}) (<-chan []*KeyValue, error) // Lock locks the given key. // The returned Locker is not held and must be acquired Lock(key string, opts ...LockOption) (Locker, error) // Close the connection Close() }
Store is the interface to access the backend
Click to show internal directories.
Click to hide internal directories.