Documentation
¶
Index ¶
- func NewEtcdStore(ctx context.Context, config Config) (kvstore.Store, error)
- type Config
- type EtcdStore
- func (s *EtcdStore) Close() error
- func (s *EtcdStore) Delete(key string) error
- func (s *EtcdStore) DeleteWith(ctx context.Context, key string) error
- func (s *EtcdStore) DeleteWithPrefix(keyPrefix string) error
- func (s *EtcdStore) DeleteWithPrefixWith(ctx context.Context, keyPrefix string) error
- func (s *EtcdStore) Get(key string) (string, bool, error)
- func (s *EtcdStore) GetKeyList(keyPrefix string) ([]string, error)
- func (s *EtcdStore) GetKeyListWith(ctx context.Context, keyPrefix string) ([]string, error)
- func (s *EtcdStore) GetKv(key string) (kvstore.KeyValue, bool, error)
- func (s *EtcdStore) GetKvList(keyPrefix string) ([]kvstore.KeyValue, error)
- func (s *EtcdStore) GetKvListWith(ctx context.Context, keyPrefix string) ([]kvstore.KeyValue, error)
- func (s *EtcdStore) GetKvMap(keyPrefix string) (kvstore.KeyValueMap, error)
- func (s *EtcdStore) GetKvMapWith(ctx context.Context, keyPrefix string) (kvstore.KeyValueMap, error)
- func (s *EtcdStore) GetKvWith(ctx context.Context, key string) (kvstore.KeyValue, bool, error)
- func (s *EtcdStore) GetList(keyPrefix string) ([]string, error)
- func (s *EtcdStore) GetListWith(ctx context.Context, keyPrefix string) ([]string, error)
- func (s *EtcdStore) GetSortedKvList(keyPrefix string, sortBy clientv3.SortTarget, order clientv3.SortOrder) ([]kvstore.KeyValue, error)
- func (s *EtcdStore) GetSortedKvListWith(ctx context.Context, keyPrefix string, sortBy clientv3.SortTarget, ...) ([]kvstore.KeyValue, error)
- func (s *EtcdStore) GetWith(ctx context.Context, key string) (string, bool, error)
- func (s *EtcdStore) NewLock(ctx context.Context, session *concurrency.Session, lockKey string) (*concurrency.Mutex, error)
- func (s *EtcdStore) NewSession(ctx context.Context) (*concurrency.Session, error)
- func (s *EtcdStore) Put(key, value string) error
- func (s *EtcdStore) PutWith(ctx context.Context, key, value string) error
- func (s *EtcdStore) WatchKey(key string) clientv3.WatchChan
- func (s *EtcdStore) WatchKeyWith(ctx context.Context, key string) clientv3.WatchChan
- func (s *EtcdStore) WatchKeys(keyPrefix string) clientv3.WatchChan
- func (s *EtcdStore) WatchKeysWith(ctx context.Context, keyPrefix string) clientv3.WatchChan
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EtcdStore ¶
type EtcdStore struct {
// contains filtered or unexported fields
}
EtcdStore represents an etcd.
func (*EtcdStore) Close ¶
Close closes the etcd client. This is necessary to release resources associated with the client.
func (*EtcdStore) DeleteWith ¶
DeleteWith removes a key-value pair from etcd using the provided context.
func (*EtcdStore) DeleteWithPrefix ¶ added in v0.12.12
DeleteWithPrefix removes all key-value pairs with the given prefix in a single etcd request.
func (*EtcdStore) DeleteWithPrefixWith ¶ added in v0.12.12
DeleteWithPrefixWith removes all key-value pairs with the given prefix in a single etcd request using the provided context.
func (*EtcdStore) GetKeyList ¶ added in v0.12.9
GetKeyList retrieves only keys (no values) with the given keyPrefix from etcd.
func (*EtcdStore) GetKeyListWith ¶ added in v0.12.9
GetKeyListWith retrieves only keys with the given keyPrefix from etcd using the provided context. Using WithKeysOnly() avoids transferring value bytes, keeping the gRPC response small even for prefixes with thousands of large values.
func (*EtcdStore) GetKvList ¶
GetKvList retrieves multiple key-value pairs with the given keyPrefix from etcd.
func (*EtcdStore) GetKvListWith ¶
func (s *EtcdStore) GetKvListWith(ctx context.Context, keyPrefix string) ([]kvstore.KeyValue, error)
GetKvListWith retrieves multiple key-value pairs with the given keyPrefix from etcd using the provided context.
func (*EtcdStore) GetKvMap ¶
func (s *EtcdStore) GetKvMap(keyPrefix string) (kvstore.KeyValueMap, error)
GetKvMap retrieves multiple key-value pairs with the given keyPrefix from etcd.
func (*EtcdStore) GetKvMapWith ¶
func (s *EtcdStore) GetKvMapWith(ctx context.Context, keyPrefix string) (kvstore.KeyValueMap, error)
GetKvMapWith retrieves multiple key-value pairs with the given keyPrefix from etcd using the provided context.
func (*EtcdStore) GetKvWith ¶
GetKvWith retrieves a key-value pair from etcd using the provided context.
func (*EtcdStore) GetList ¶
GetListWith retrieves multiple values for keys with the given keyPrefix from etcd.
func (*EtcdStore) GetListWith ¶
GetListWith retrieves multiple values for keys with the given keyPrefix from etcd using the provided context.
func (*EtcdStore) GetSortedKvList ¶
func (s *EtcdStore) GetSortedKvList(keyPrefix string, sortBy clientv3.SortTarget, order clientv3.SortOrder) ([]kvstore.KeyValue, error)
GetSortedKvList retrieves multiple values for keys with the given keyPrefix, sortBy, and order from etcd.
func (*EtcdStore) GetSortedKvListWith ¶
func (s *EtcdStore) GetSortedKvListWith(ctx context.Context, keyPrefix string, sortBy clientv3.SortTarget, order clientv3.SortOrder) ([]kvstore.KeyValue, error)
GetSortedKvListWith retrieves multiple values for keys with the given keyPrefix, sortBy, and order from etcd using the provided context.
func (*EtcdStore) GetWith ¶
GetWith retrieves the value for a given key from etcd using the provided context.
func (*EtcdStore) NewLock ¶
func (s *EtcdStore) NewLock(ctx context.Context, session *concurrency.Session, lockKey string) (*concurrency.Mutex, error)
NewLock acquires a lock on the given key and returns the mutex. It uses the provided session to ensure the lock's lifecycle is tied to the session.
func (*EtcdStore) NewSession ¶
OpenSession creates a new etcd session. A session is needed for acquiring locks.
func (*EtcdStore) WatchKeyWith ¶
WatchKeyWith watches for changes on the given key using the provided context.