Documentation ¶
Overview ¶
Package memdb provides a memory-backed implementation of the db.DB interface.
A MemDB's memory consumption increases monotonically, even if keys are deleted or values are updated with shorter slices. Callers of the package are responsible for explicitly compacting a MemDB into a separate DB (whether in-memory or on-disk) when appropriate.
Index ¶
- type MemDB
- func (m *MemDB) ApproximateMemoryUsage() int
- func (m *MemDB) Close() error
- func (m *MemDB) Delete(key []byte, o *db.WriteOptions) error
- func (m *MemDB) Find(key []byte, o *db.ReadOptions) db.Iterator
- func (m *MemDB) Get(key []byte, o *db.ReadOptions) (value []byte, err error)
- func (m *MemDB) Set(key, value []byte, o *db.WriteOptions) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MemDB ¶
type MemDB struct {
// contains filtered or unexported fields
}
MemDB is a memory-backed implementation of the db.DB interface.
It is safe to call Get, Set, Delete and Find concurrently.
func (*MemDB) ApproximateMemoryUsage ¶
ApproximateMemoryUsage returns the approximate memory usage of the MemDB.
func (*MemDB) Delete ¶
func (m *MemDB) Delete(key []byte, o *db.WriteOptions) error
Delete implements DB.Delete, as documented in the leveldb/db package.
Click to show internal directories.
Click to hide internal directories.