Common database interface for various database backends. This is forked for applications built on Ostracon, such as the LBM SDK from Tendermint tm-db, but can be used independently of these as well.
Go 1.16+
-
GoLevelDB [stable]: A pure Go implementation of LevelDB (see below). Currently the default on-disk database used in the Cosmos SDK.
-
MemDB [stable]: An in-memory database using Google's B-tree package. Has very high performance both for reads, writes, and range scans, but is not durable and will lose all data on process exit. Does not support transactions. Suitable for e.g. caches, working sets, and tests. Used for IAVL working sets when the pruning strategy allows it.
-
LevelDB [rc]: A Go wrapper around LevelDB. Uses LSM-trees for on-disk storage, which have good performance for write-heavy workloads, particularly on spinning disks, but requires periodic compaction to maintain decent read performance and reclaim disk space. Does not support transactions.
-
RocksDB [rc]: A Go wrapper around RocksDB. Similarly to LevelDB (above) it uses LSM-trees for on-disk storage, but is optimized for fast storage media such as SSDs and memory. Supports atomic transactions, but not full ACID transactions.
-
BoltDB [experimental]: A fork of BoltDB. Uses B+trees for on-disk storage, which have good performance for read-heavy workloads and range scans. Supports serializable ACID transactions.
-
BadgerDB [experimental]: A key-value database written as a pure-Go alternative to e.g. LevelDB and RocksDB, with LSM-tree storage. Makes use of multiple goroutines for performance, and includes advanced features such as serializable ACID transactions, write batches, compression, and more.
-
PrefixDB [stable]: A database which wraps another database and uses a static prefix for all keys. This allows multiple logical databases to be stored in a common underlying databases by using different namespaces. Used by the Cosmos SDK to give different modules their own namespaced database in a single application database.
-
RemoteDB [experimental]: A database that connects to distributed Tendermint db instances via gRPC. This can help with detaching difficult deployments such as LevelDB, and can also ease dependency management for Tendermint developers.
To test common databases, run make test
. If all databases are available on the local machine, use make test-all
to test them all.
make test
make test-all
make test-all-docker
make bench
make bench-all
make bench-all-docker
# Read/Write
make bench-rw-all
# Scan 1M
make bench-scan1m-all
# Scan 10M
make bench-scan10m-all