Documentation
¶
Overview ¶
The storage package defines a key-value based storage engine interface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeCounter ¶
DecodeCounter decodes bytes into a uint64.
func EncodeCounter ¶
EncodeCounter encodes an uint64 into bytes.
Types ¶
type Engine ¶
type Engine interface { // Get takes a key and returns the associated bytes. Get(part, key string) ([]byte, error) // Set takes a key and bytes and writes it to storage. Set(part, key string, value []byte) error // Delete takes a key and deletes the entry from storage. Delete(part, key string) error // Incr increments an integer or sets it to one for new entries. Incr(part, key string) (uint64, error) // Multi takes a function that takes a transaction value. For storages // that support batch writes, this should be used. Multi(func(Tx) error) error }
Engine is an interface for defining storage engines.
type Initializer ¶
Initializer is a function type that takes options and returns an initialized storage engine.
type Options ¶
type Options map[string]interface{}
Options is a general purpose map for accessing options for storage engines.
func (Options) GetBool ¶
GetBool returns a boolean value associated with the key. If the conversion fails, this will panic.
type Tx ¶
type Tx interface { // Get takes a key and returns the associated bytes. Get(part, key string) ([]byte, error) // Set takes a key and bytes and writes it to storage. Set(part, key string, value []byte) error // Delete takes a key and deletes the entry from storage. Delete(part, key string) error // Incr increments an integer or sets it to one for new entries. Incr(part, key string) (uint64, error) }
Tx is an interface for representing a storage transaction. The calls executed by a transaction must be wrapped in a transaction context by engine implementations.
Click to show internal directories.
Click to hide internal directories.