kv

package
v2.1.4 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrKeyNotFound = errors.New("key not found")

ErrKeyNotFound is raised when the given key could not be found in the store.

Functions

func CreateEndpoints

func CreateEndpoints(addrs []string, scheme string) (entries []string)

CreateEndpoints creates a list of endpoints given the right scheme.

func GetDirectory

func GetDirectory(key string) string

GetDirectory gets the full directory part of the key to the form:

path/to/

func Normalize

func Normalize(key string) string

Normalize the key for each store to the form:

path/to/key

func SplitKey

func SplitKey(key string) (path []string)

SplitKey splits the key to extract path informations.

Types

type Pair

type Pair struct {
	Key     string
	Value   []byte
	Version uint64
}

type Store

type Store interface {
	// Get the value stored at the given key.
	Get(ctx context.Context, key string) (*Pair, error)
	// Exists checks if the key exists inside the store
	Exists(ctx context.Context, key string) (bool, error)
	// Delete a value addressed by "key"
	Delete(ctx context.Context, key string) error
	// Put the given value at the given key.
	Put(ctx context.Context, key string, value []byte) error
	// List subkeys at a given path
	List(ctx context.Context, path string) ([]*Pair, error)
	// Close closes the client connection
	Close() error
}

Store describes the key/value store contract.

Directories

Path Synopsis
mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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