Documentation ¶
Overview ¶
Package kvmemdb implements an in-memory key-value database with snapshots and read/write transactions. Snapshots can be taken periodically to backup and restore the database.
Database can be used by multiple goroutines simultaneously, however, individual Snapshot and Transaction objects are not thread-safe; they can only be used by a single goroutine.
Index ¶
- func Backup(db *DB, file string) error
- func Compact(ctx context.Context, db *DB) int
- type DB
- type Iterator
- type Snapshot
- func (s *Snapshot) Ascend(ctx context.Context, begin, end string) (kv.Iterator, error)
- func (s *Snapshot) Descend(ctx context.Context, begin, end string) (kv.Iterator, error)
- func (s *Snapshot) Discard(ctx context.Context) error
- func (s *Snapshot) Get(ctx context.Context, key string) (io.Reader, error)
- func (s *Snapshot) Scan(ctx context.Context) (kv.Iterator, error)
- type Transaction
- func (t *Transaction) Ascend(ctx context.Context, begin, end string) (kv.Iterator, error)
- func (t *Transaction) Commit(ctx context.Context) error
- func (t *Transaction) Delete(ctx context.Context, key string) error
- func (t *Transaction) Descend(ctx context.Context, begin, end string) (kv.Iterator, error)
- func (t *Transaction) Get(ctx context.Context, key string) (io.Reader, error)
- func (t *Transaction) Rollback(ctx context.Context) error
- func (t *Transaction) Scan(ctx context.Context) (kv.Iterator, error)
- func (t *Transaction) Set(ctx context.Context, key string, value io.Reader) error
- func (t *Transaction) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Snapshot ¶
type Snapshot struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.