Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotFound is returned when the store implementation cannot find the value // for a given key. ErrNotFound = errors.New("store: key not found") // ErrCantDecode is returned when a store adaptor cannot decode the store format // to a value used by the code. ErrCantDecode = errors.New("store: can't decode value") // ErrCantEncode is returned when a store adaptor cannot encode the value into // the format that the store uses. ErrCantEncode = errors.New("store: can't encode value") // ErrBadConfig is returned when a store adaptor's configuration is invalid. ErrBadConfig = errors.New("store: configuration is invalid") )
Functions ¶
Types ¶
type Factory ¶
type Factory interface {
Build(ctx context.Context, config json.RawMessage) (Interface, error)
Valid(config json.RawMessage) error
}
type Interface ¶
type Interface interface {
// Delete removes a value from the store by key.
Delete(ctx context.Context, key string) error
// Get returns the value of a key assuming that value exists and has not expired.
Get(ctx context.Context, key string) ([]byte, error)
// Set puts a value into the store that expires according to its expiry.
Set(ctx context.Context, key string, value []byte, expiry time.Duration) error
}
Interface defines the calls that Anubis uses for storage in a local or remote datastore. This can be implemented with an in-memory, on-disk, or in-database storage backend.
Click to show internal directories.
Click to hide internal directories.