Documentation ¶
Index ¶
Constants ¶
View Source
const ( // TypeBadger is identifier to specify that we want to use Badger // as metadata db TypeBadger = "badger" // TypeETCD is identifier to specify that we want to use ETCD // as metadata db TypeETCD = "etcd" )
Variables ¶
View Source
var ( // ErrNotFound is the error returned by a metastor KV database, // in case metadata requested couldn't be found. ErrNotFound = errors.New("metastor: key couldn't be found") // ErrTimeout is the error returned by a metastor KV database, // in case the database timed out. ErrTimeout = errors.New("metastor: database timed out") // in case the database is unavailable. ErrUnavailable = errors.New("metastor: database is unavailable") )
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB interface { // Set given key in the database equal to the processed metadata. Set(namespace, key, metadata []byte) error // Get the stored metadata from the database using the given key. Get(namespace, key []byte) (metadata []byte, err error) // Delete the metadata which is stored as the given key. Delete(namespace, key []byte) error // Update metadata stored as the given key, // as an in-memory-transaction, providing protection against data races. // When wishing to update metadata always use this method, // rather than a combination of Set+Get. Update(namespace, key []byte, cb UpdateCallback) error // ListKeys all keys in the given namespace. // The keys are sorted in lexicographically order. ListKeys(namespace []byte, cb ListCallback) error // Close any open (database) resources. Close() error }
DB interface is the interface defining how to interact with a key value store, as ued for metadata storage. ALl DB implements are assumed to be threadsafe.
type InternalError ¶
InternalError can be returned by a database as a generic internal error, retaining the actual internal error as part of the returned error.
type ListCallback ¶
ListCallback is the type of callback used to process the listed keys
type UpdateCallback ¶
UpdateCallback is the type of callback used to update the processed (encoded) metadata, which was already stored, previously.
Click to show internal directories.
Click to hide internal directories.