Expand description
Re-exports§
pub use mdbx::create_db;
mdbx
pub use mdbx::init_db;
mdbx
pub use mdbx::open_db;
mdbx
pub use mdbx::open_db_read_only;
mdbx
pub use mdbx::DatabaseEnv;
mdbx
pub use mdbx::DatabaseEnvKind;
mdbx
Modules§
- common
- Common types used throughout the abstraction.
- cursor
- Cursor database traits.
- database
- Database traits.
- database_
metrics - Database metrics trait extensions.
- lockfile
- Storage lock utils.
- mdbx
mdbx
- Helper functions for initializing and opening a database.
- mock
- Mock database
- models
- Implements data structures specific to the database
- static_
file - reth’s static file database table import and access
- table
- Table traits
- tables
- Tables and data models.
- test_
utils test-utils
- Collection of database test utilities
- transaction
- Transaction database traits.
- version
- Database version utils.
Macros§
- add_
static_ file_ mask - Add mask to select
N
column values from a specific static file segment row. - impl_
fixed_ arbitrary - Implements the
Arbitrary
trait for types with fixed array types. - tables
- Defines all the tables in the database.
- tables_
to_ generic - Maps a run-time
Tables
enum value to its corresponding compile-timeTable
type.
Structs§
- Account
Change Sets - Stores the state of an account before a certain transaction changed it. Change on state can be: account is created, selfdestructed, touched while empty or changed balance,nonce.
- Accounts
History - Stores pointers to block changeset with changes for each account key.
- Accounts
Trie - Stores the current state’s Merkle Patricia Tree.
- Block
Body Indices - Stores block indices that contains indexes of transaction and the count of them.
- Block
Ommers - Stores the uncles/ommers of the block.
- Block
Withdrawals - Stores the block withdrawals.
- Bytecodes
- Stores all smart contract bytecodes. There will be multiple accounts that have same bytecode So we would need to introduce reference counter. This will be small optimization on state.
- Canonical
Headers - Stores the header hashes belonging to the canonical chain.
- Chain
State - Stores generic chain state info, like the last finalized block.
- Client
Version - Client version that accessed the database.
- Hashed
Accounts - Stores the current state of an [
Account
] indexed withkeccak256Address
This table is in preparation for merklization and calculation of state root. We are saving whole account data as it is needed for partial update when part of storage is changed. Benefit for merklization is that hashed addresses are sorted. - Hashed
Storages - Stores the current storage values indexed with
keccak256Address
and hash of storage keykeccak256key
. This table is in preparation for merklization and calculation of state root. Benefit for merklization is that hashed addresses/keys are sorted. - Header
Numbers - Stores the block number corresponding to a header.
- Header
Terminal Difficulties - Stores the total difficulty from a block header.
- Headers
- Stores header bodies.
- Plain
Account State - Stores the current state of an [
Account
]. - Plain
Storage State - Stores the current value of a storage key.
- Prune
Checkpoints - Stores the highest pruned block number and prune mode of each prune segment.
- RawDup
Sort - Raw
DupSort
table that can be used to access any table and its data in raw mode. This is useful for delayed decoding/encoding of data. - RawKey
- Raw table key.
- RawTable
- Raw table that can be used to access any table and its data in raw mode. This is useful for delayed decoding/encoding of data.
- RawValue
- Raw table value.
- Receipts
- Canonical only Stores transaction receipts.
- Stage
Checkpoint Progresses - Stores arbitrary data to keep track of a stage first-sync progress.
- Stage
Checkpoints - Stores the highest synced block number and stage-specific checkpoint of each stage.
- Storage
Change Sets - Stores the state of a storage key before a certain transaction changed it.
If [
StorageEntry::value
] is zero, this means storage was not existing and needs to be removed. - Storages
History - Stores pointers to block number changeset with changes for each storage key.
- Storages
Trie - From HashedAddress => NibblesSubKey => Intermediate value
- Transaction
Blocks - Stores the mapping of transaction number to the blocks number.
- Transaction
Hash Numbers - Stores the mapping of the transaction hash to the transaction number.
- Transaction
Senders - Stores the transaction sender for each canonical transaction. It is needed to speed up execution stage and allows fetching signer without doing transaction signed recovery
- Transactions
- Canonical only Stores the transaction body for canonical transactions.
- Version
History - Stores the history of client versions that have accessed the database with write privileges by unix timestamp in seconds.
Enums§
- Chain
State Key - Keys for the
ChainState
table. - Database
Error - Database error type.
- Database
Write Operation - Database write operation type.
- Table
Type - Enum for the types of tables present in libmdbx.
- Tables
- A table in the database.
Traits§
- Database
- Main Database trait that can open read-only and read-write transactions.
- DbTx
Unwind Ext - Extension trait for
DbTxMut
that provides unwind functionality. - Table
Set - General trait for defining the set of tables Used to initialize database
- Table
Viewer - The general purpose of this is to use with a combination of Tables enum,
by implementing a
TableViewer
trait you can operate on db tables in an abstract way.
Functions§
- is_
database_ empty mdbx
- Check if a db is empty. It does not provide any information on the validity of the data in it. We consider a database as non empty when it’s a non empty directory.
Type Aliases§
- Block
Number List - List with transaction numbers.
- StageId
- Encoded stage id.
- Table
RawRow - Tuple with
RawKey<T::Key>
andRawValue<T::Value>
.