Documentation ¶
Index ¶
- type MemDB
- func (dbm *MemDB) Close() error
- func (dbm *MemDB) DeleteVersion(target uint64) error
- func (dbm *MemDB) Print() error
- func (dbm *MemDB) ReadWriter() db.DBReadWriter
- func (dbm *MemDB) Reader() db.DBReader
- func (dbm *MemDB) ReaderAt(version uint64) (db.DBReader, error)
- func (dbm *MemDB) Revert() error
- func (dbm *MemDB) SaveNextVersion() (uint64, error)
- func (dbm *MemDB) SaveVersion(target uint64) error
- func (dbm *MemDB) Stats() map[string]string
- func (dbm *MemDB) Versions() (db.VersionSet, error)
- func (dbm *MemDB) Writer() db.DBWriter
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 an in-memory database backend using a B-tree for storage.
For performance reasons, all given and returned keys and values are pointers to the in-memory database, so modifying them will cause the stored values to be modified as well. All DB methods already specify that keys and values should be considered read-only, but this is especially important with MemDB.
Versioning is implemented by maintaining references to copy-on-write clones of the backing btree.
Note: Currently, transactions do not detect write conflicts, so multiple writers cannot be safely committed to overlapping domains. Because of this, the number of open writers is limited to 1.
func (*MemDB) Close ¶
Close implements DB. Close is a noop since for an in-memory database, we don't have a destination to flush contents to nor do we want any data loss on invoking Close(). See the discussion in https://github.com/tendermint/tendermint/libs/pull/56
func (*MemDB) DeleteVersion ¶
DeleteVersion implements DBConnection.
func (*MemDB) ReadWriter ¶
func (dbm *MemDB) ReadWriter() db.DBReadWriter
ReadWriter implements DBConnection.
func (*MemDB) SaveNextVersion ¶
SaveVersion implements DBConnection.
func (*MemDB) SaveVersion ¶
SaveNextVersion implements DBConnection.