package
2.0.0+incompatible
Repository: https://github.com/okex/exchain.git
Documentation: pkg.go.dev

# README

Tendermint DB

Test Lint

Common database interface for various database backends. Primarily meant for applications built on Tendermint, such as the Cosmos SDK, but can be used independently of these as well.

Minimum Go Version

Go 1.13+

Supported Database Backends

  • 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 [experimental]: 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.

  • 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.

  • RocksDB [experimental]: 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.

Meta-databases

  • 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.

Tests

To test common databases, run make test. If all databases are available on the local machine, use make test-all to test them all.

# Packages

remotedb is a package for connecting to distributed Tendermint db.DB instances.

# Functions

No description provided by the author
See DB interface documentation for more information.
IteratePrefix is a convenience function for iterating over a key domain restricted by prefix.
NewDB creates a new database of type backend with the given name.
No description provided by the author
No description provided by the author
NewMemDB creates a new in-memory database.
NewPrefixDB lets you namespace multiple DBs within a single DB.

# Constants

BoltDBBackend represents bolt (uses etcd's fork of bolt - github.com/etcd-io/bbolt) - EXPERIMENTAL - may be faster is some use-cases (random reads - indexer) - use boltdb build tag (go build -tags boltdb).
No description provided by the author
CLevelDBBackend represents cleveldb (uses levigo wrapper) - fast - requires gcc - use cleveldb build tag (go build -tags cleveldb).
No description provided by the author
These are valid backend types.
These are valid backend types.
No description provided by the author
GoLevelDBBackend represents goleveldb (github.com/syndtr/goleveldb - most popular implementation) - pure go - stable.
No description provided by the author
No description provided by the author
MemDBBackend represents in-memory key value store, which is mostly used for testing.
No description provided by the author
RocksDBBackend represents rocksdb (uses github.com/tecbot/gorocksdb) - EXPERIMENTAL - requires gcc - use rocksdb build tag (go build -tags rocksdb).
No description provided by the author
UnknownDBBackend unknown db type.

# Structs

No description provided by the author
MemDB is an in-memory database backend using a B-tree for storage.
PrefixDB wraps a namespace of another database as a logical database.

# Interfaces

Batch represents a group of writes.
DB is the main interface for all database backends.
Iterator represents an iterator over a domain of keys.
No description provided by the author

# Type aliases

No description provided by the author
UnsafeValueProcessor called after DB Get if the error of Get is nil, value is the result of DB Get.