Documentation ¶
Overview ¶
Package api defines abstract backend interface.
Index ¶
Constants ¶
View Source
const PathSeparator = "/"
PathSeparator used in key paths.
Variables ¶
View Source
var ( ErrNotExist = errors.New("key path does not exist") ErrExist = errors.New("key path already exists") ErrInvalidPath = errors.New("invalid key path") )
Errors returned by filesystem.Backend:
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend interface { // Get data at given path. // Returns ErrNotExist if path does not exist. Get(path string) ([]byte, error) // Put data at given path. // Returns ErrExist if path already exists. Put(path string, data []byte) error // ListAll enumerates all paths currently stored. // The paths are returned in lexicographical order. ListAll() ([]string, error) // Rename oldpath into newpath atomically. // Replaces newpath if it already exists. // Returns ErrNotExist if oldpath does not exist. Rename(oldpath, newpath string) error // Rename oldpath into newpath non-destructively. // Returns ErrExist if newpath already exists. // Returns ErrNotExist if oldpath does not exist. RenameNX(oldpath, newpath string) error // Lock acquires an exclusive lock on the store, suitable for writing. // This call blocks until the lock is acquired. // It can also deadlock if you already hold the lock. Lock() error // RLock acquires a shared lock on the store, suitable for reading. // This call blocks until the lock is acquired. RLock() error // Unlock releases the exclusive lock currently held by the process. // It is an error to call it without calling Lock() first. Unlock() error // RUnlock releases the shared lock currently held by the process. // It is an error to call it without calling RLock() first. RUnlock() error // Close this backend instance, freeing any associated resources. // This implicitly unlocks the store if any locks are held. Close() error }
Backend defines how KeyStore persists internal key data.
Click to show internal directories.
Click to hide internal directories.