testdb

package
v2.3.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Testdb

This package contains an in memory DB for testing purpose only. The original code was copied from https://github.com/tendermint/tm-db/tree/v0.6.7 to decouple project dependencies.

All credits and a big thank you go to the original authors!

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Iterator

type Iterator = types.Iterator

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.

func NewMemDB

func NewMemDB() *MemDB

NewMemDB creates a new in-memory database.

func (*MemDB) Close

func (db *MemDB) Close() error

Close implements DB.

func (*MemDB) Delete

func (db *MemDB) Delete(key []byte) error

Delete implements DB.

func (*MemDB) DeleteSync

func (db *MemDB) DeleteSync(key []byte) error

DeleteSync implements DB.

func (*MemDB) Get

func (db *MemDB) Get(key []byte) ([]byte, error)

Get implements DB.

func (*MemDB) Has

func (db *MemDB) Has(key []byte) (bool, error)

Has implements DB.

func (*MemDB) Iterator

func (db *MemDB) Iterator(start, end []byte) (Iterator, error)

Iterator implements DB. Takes out a read-lock on the database until the iterator is closed.

func (*MemDB) IteratorNoMtx

func (db *MemDB) IteratorNoMtx(start, end []byte) (Iterator, error)

IteratorNoMtx makes an iterator with no mutex.

func (*MemDB) Print

func (db *MemDB) Print() error

Print implements DB.

func (*MemDB) ReverseIterator

func (db *MemDB) ReverseIterator(start, end []byte) (Iterator, error)

ReverseIterator implements DB. Takes out a read-lock on the database until the iterator is closed.

func (*MemDB) ReverseIteratorNoMtx

func (db *MemDB) ReverseIteratorNoMtx(start, end []byte) (Iterator, error)

ReverseIteratorNoMtx makes an iterator with no mutex.

func (*MemDB) Set

func (db *MemDB) Set(key []byte, value []byte) error

Set implements DB.

func (*MemDB) SetSync

func (db *MemDB) SetSync(key []byte, value []byte) error

SetSync implements DB.

func (*MemDB) Stats

func (db *MemDB) Stats() map[string]string

Stats implements DB.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL