package kvstore
import "github.com/dotcloud/docker/libnetwork/internal/kvstore"
Index ¶
Variables ¶
var ( // ErrBackendNotSupported is thrown when the backend k/v store is not supported by libkv ErrBackendNotSupported = errors.New("Backend storage not supported yet, please choose one of") // ErrKeyModified is thrown during an atomic operation if the index does not match the one in the store ErrKeyModified = errors.New("Unable to complete atomic operation, key modified") // ErrKeyNotFound is thrown when the key is not found in the store during a Get operation ErrKeyNotFound = errors.New("Key not found in store") // ErrPreviousNotSpecified is thrown when the previous value is not specified for an atomic operation ErrPreviousNotSpecified = errors.New("Previous K/V pair should be provided for the Atomic operation") // ErrKeyExists is thrown when the previous value exists in the case of an AtomicPut ErrKeyExists = errors.New("Previous K/V pair exists, cannot complete Atomic operation") )
Types ¶
type Backend ¶
type Backend string
Backend represents a KV Store Backend
const BOLTDB Backend = "boltdb"
BOLTDB backend
type KVPair ¶
KVPair represents {Key, Value, LastIndex} tuple
type Store ¶
type Store interface { // Put a value at the specified key Put(key string, value []byte) error // Exists verifies if a Key exists in the store. Exists(key string) (bool, error) // List the content of a given prefix List(directory string) ([]*KVPair, error) // AtomicPut performs an atomic CAS operation on a single value. // Pass previous = nil to create a new key. AtomicPut(key string, value []byte, previous *KVPair) (*KVPair, error) // AtomicDelete performs an atomic delete of a single value. AtomicDelete(key string, previous *KVPair) error // Delete deletes a value at "key". Unlike AtomicDelete it doesn't check // whether the deleted key is at a specific version before deleting. Delete(key string) error // Close the store connection Close() }
Store represents the backend K/V storage Each store should support every call listed here. Or it couldn't be implemented as a K/V backend for libkv
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
libnetwork/internal/kvstore/boltdb |
- Version
- v28.0.1+incompatible
- Published
- Feb 26, 2025
- Platform
- js/wasm
- Imports
- 1 packages
- Last checked
- 10 seconds ago –
Tools for package owners.