Documentation
¶
Index ¶
Constants ¶
View Source
const DefaultStorageSnapshotInterval = 1 * time.Minute
DefaultStorageSnapshotInterval is the default interval, in which snapshots are being stored to disks in the storage.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Codec ¶
type Codec interface {
Encode(value interface{}) (data []byte, err error)
Decode(data []byte) (value interface{}, err error)
}
Codec decodes and encodes from and to []byte
type Iterator ¶
type Iterator interface {
// Next advances the iterator to the next key.
Next() bool
// Key gets the current key. If the iterator is exhausted, key will return
// nil.
Key() []byte
// Value gets the current value. Value is decoded with the codec given to the
// storage.
Value() (interface{}, error)
// Release releases the iterator. After release, the iterator is not usable
// anymore.
Release()
}
Iterator provides iteration access to the stored values.
type Storage ¶
type Storage interface {
Has(string) (bool, error)
Get(string) (interface{}, error)
Set(string, interface{}) error
SetEncoded(string, []byte) error
Delete(string) error
SetOffset(value int64) error
GetOffset(defValue int64) (int64, error)
Iterator() Iterator
Open() error
Close() error
Sync()
}
Storage abstracts the interface for a persistent local storage
Click to show internal directories.
Click to hide internal directories.