Documentation ¶
Overview ¶
The storage package provides a key/value based interface for storing Kapacitor metadata. All services wishing to store data should use this interface.
The usage patterns for this storage layer are typical create/replace/delete/get/list operations. Typically objects are serialized and stored as the value. As a result, updates to a single field of an object can incur the cost to retrieve the entire object and store it again. In most cases this is acceptable since modifications are rare and object size is small.
A BoltDB backed implementation is also provided.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrNoKeyExists = errors.New("no key exists")
)
Common errors that can be returned
Functions ¶
Types ¶
type Bolt ¶
type Bolt struct {
// contains filtered or unexported fields
}
Bolt implementation of Store
type Config ¶
type Config struct { // Path to a boltdb database file. BoltDBPath string `toml:"boltdb"` }
type Interface ¶
type Interface interface { // Store a value. Put(key string, value []byte) error // Retrieve a value. Get(key string) (*KeyValue, error) // Delete a key. // Deleting a non-existent key is not an error. Delete(key string) error // Check if a key exists> Exists(key string) (bool, error) // List all values with given prefix. List(prefix string) ([]*KeyValue, error) }
Common interface for interacting with a simple Key/Value storage