etcd

package
v0.0.0-...-73c8340 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataStore

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

DataStore wraps a clientv3 datastore.

func New

func New(client *clientv3.Client) *DataStore

New creates a new clientv3 for use as a KVStore.

func (*DataStore) Close

func (w *DataStore) Close() error

Close closes the underlying datastore. All other operations will fail after calling Close.

func (*DataStore) Delete

func (w *DataStore) Delete(key string) error

Delete deletes the value for the given key from the datastore.

func (*DataStore) DeleteAll

func (w *DataStore) DeleteAll(keys []string) error

DeleteAll deletes all of the given keys and corresponding values in the datastore if they exist.

func (*DataStore) DeleteWithPrefix

func (w *DataStore) DeleteWithPrefix(prefix string) error

DeleteWithPrefix deletes all keys and values with the given prefix.

func (*DataStore) Get

func (w *DataStore) Get(key string) ([]byte, error)

Get gets the value for the given key from the datastore.

func (*DataStore) GetWithPrefix

func (w *DataStore) GetWithPrefix(prefix string) ([]string, [][]byte, error)

GetWithPrefix gets all keys and values with the given prefix.

func (*DataStore) GetWithRange

func (w *DataStore) GetWithRange(from string, to string) ([]string, [][]byte, error)

GetWithRange gets all keys and values within the given range. Treats this as [from, to) i.e. includes the key from, but excludes the key to.

func (*DataStore) Set

func (w *DataStore) Set(key string, value string) error

Set puts the given key and value in the datastore.

func (*DataStore) SetWithTTL

func (w *DataStore) SetWithTTL(key string, value string, ttl time.Duration) error

SetWithTTL puts the given key and value into the datastore with a TTL. Once the TTL expires the datastore is expected to delete the given key and value.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL