Documentation ¶
Index ¶
- func AllKeys(storage Storage) ([][]byte, error)
- func AllKeysString(storage Storage) ([]string, error)
- func AllNamespaces(storage NamespacedStorage) ([][]byte, error)
- func AllNamespacesString(storage NamespacedStorage) ([]string, error)
- func Redundant(writer DWriter, reader DReader, keysDeduplication Dedup, back ...Storage) *redundant
- func RedundantAll(keysDeduplication Dedup, back ...Storage) *redundant
- type Accessor
- type BatchedStorage
- type Clearable
- type DReader
- type DWriter
- type Dedup
- type Iterator
- type KV
- type LegacyQueue
- type LimitedQueue
- type NamespacedStorage
- type Queue
- type Reader
- type ShardPool
- type Storage
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllKeysString ¶ added in v0.0.2
Extract all keys from storage and convert it to string
func AllNamespaces ¶ added in v0.2.0
func AllNamespaces(storage NamespacedStorage) ([][]byte, error)
Extract all namespaces from storage as-is
func AllNamespacesString ¶ added in v0.2.0
func AllNamespacesString(storage NamespacedStorage) ([]string, error)
Extract all namespaces from storage as string
func Redundant ¶ added in v0.2.0
Redundant storage with custom strategy for writing and reading backed by several storage
func RedundantAll ¶ added in v0.2.0
Redundant storage that writes values to all back storages and read from first successful.
Types ¶
type Accessor ¶ added in v0.0.8
type Accessor interface { // Get item from storage. If not exists - os.ErrNotExist (implementation independent) Get(key []byte) ([]byte, error) // Put single item to storage. If already exists - override Put(key []byte, data []byte) error // Delete key and value Del(key []byte) error }
Access only interface for storage
type BatchedStorage ¶ added in v0.0.4
Atomic (batch) writer. Batch storage should be used only in one thread
type Clearable ¶ added in v0.2.0
type Clearable interface { // Clear all data in storage Clear() error }
Clear storage
type DWriter ¶ added in v0.2.0
Distributed writer strategy
type Dedup ¶ added in v0.2.0
type Dedup interface { // Is key already save? IsDuplicated(key []byte) (bool, error) // Save key for future checks Save(key []byte) error }
Deduplicate primitive: check if key is already saved and save key
type Iterator ¶ added in v0.0.8
type Iterator interface { // Is queue has next value Next() bool // Current id ID() int64 // Current value Value() []byte }
Queue iterator
type KV ¶ added in v0.0.2
type KV interface { Writer // Get item from storage. If not exists - os.ErrNotExist (implementation independent) Get(key []byte) ([]byte, error) // Delete key and value Del(key []byte) error }
Thread-safe storage for key-value
type LegacyQueue ¶ added in v0.2.0
type LegacyQueue interface { // put data to queue using new sequence id Put(data []byte) (id int64, err error) // peek latest data Peek() (id int64, data []byte, err error) // clean data in range: [first;end) Clean(end int64) error // size of queue (last-first) Size() int64 // first (oldest) sequence id First() int64 // last (latest) sequence id Last() int64 // iterate over items from first (if from is 0) to last (next should be called first) or till first error. // Iterator keeps min and max sequence number so cleaning items during iteration may cause iteration stop Iterate(from int64) Iterator }
Wrapper around storage that makes sequential data inserting and peeking Without external access to the data Queue guarantees that sequences are without space and strictly increasing. If queue has no data sequence is flushed (starts from 0) after restart
type LimitedQueue ¶ added in v0.0.8
type LimitedQueue interface { LegacyQueue // available space (limit - size) Available() int64 // limit Limit() int64 }
Queue with limited size
type NamespacedStorage ¶ added in v0.2.0
type NamespacedStorage interface { Storage // Get or create nested storage. Optionally can be also NamespacedStorage but it is implementation defined Namespace(name []byte) (Storage, error) // Iterate over all namespaces in storage (not including nested) Namespaces(handler func(name []byte) error) error // Delete nested namespace by name. If namespace still in usage - result undefined DelNamespace(name []byte) error }
Nested storage with namespace support (implementation defined). Namespaces and regular values may live in a same key-space.
type Queue ¶ added in v0.0.8
type Queue interface { // Put data to the queue Put(data []byte) error // Get oldest record but not remove it. Returns os.ErrNotExists if queue is empty Peek() ([]byte, error) // Discard oldest record. Returns os.ErrNotExists if queue is empty Discard() error // Get oldest record and remove it. Returns os.ErrNotExists if queue is empty. Basically - it's atomic version of Peek & Discard Get() ([]byte, error) }
Thread safe queue
type Reader ¶ added in v0.0.8
type Reader interface { // Get item from storage. If not exists - os.ErrNotExist (implementation independent) Get(key []byte) ([]byte, error) }
Key-value reader
type ShardPool ¶ added in v0.2.0
type ShardPool interface { // Get storage based on key Get(key []byte) (Storage, error) // Iterate over shards Iterate(handler func(storage Storage) error) error io.Closer }
Sharding pool
type Storage ¶
type Storage interface { KV // Iterate over all keys. Modification during iteration may cause undefined behaviour (mostly - dead-lock) Keys(handler func(key []byte) error) error }
Extension for KV storage with iterator over keys
func Compressed ¶ added in v0.2.0
Compressed storage where values are compressed by gzip
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
Graph-like operations on top of storage The package is in work-in-progress status.
|
Graph-like operations on top of storage The package is in work-in-progress status. |
This is supporting package for future developing: code generation, databases and so on.
|
This is supporting package for future developing: code generation, databases and so on. |
This is collection of standard storages backend.
|
This is collection of standard storages backend. |