Expand description
The primary implementation of the zebra_state::Service built upon rocksdb.
Zebra’s database is implemented in 4 layers:
FinalizedState: queues, validates, and commits blocks, using…ZebraDb: reads and writeszebra_chaintypes to the state database, using…DiskDb: reads and writes generic types to any column family in the database, using…disk_format: converts types to raw database bytes.
These layers allow us to split zebra_chain types for efficient database storage.
They reduce the risk of data corruption bugs, runtime inconsistencies, and panics.
§Correctness
crate::constants::state_database_format_version_in_code() must be incremented
each time the database format (column, serialization, etc) changes.
Re-exports§
pub use column_family::TypedColumnFamily;pub use column_family::WriteTypedBatch;pub use disk_db::DiskDb;pub use disk_db::DiskWriteBatch;pub use disk_db::ReadDisk;pub use disk_db::WriteDisk;pub use disk_format::FromDisk;pub use disk_format::IntoDisk;pub use disk_format::OutputLocation;pub use disk_format::RawBytes;pub use disk_format::TransactionIndex;pub use disk_format::TransactionLocation;pub use disk_format::MAX_ON_DISK_HEIGHT;pub use zebra_db::ZebraDb;pub use disk_format::KV;pub use disk_format::upgrade::restorable_db_versions;
Modules§
- arbitrary 🔒
- Arbitrary value generation and test harnesses for the finalized state.
- column_
family - Type-safe column family access.
- disk_db 🔒
- Provides low-level access to RocksDB using some database-specific types.
- disk_
format 🔒 - Serialization formats for finalized data.
- zebra_
db 🔒 - Provides high-level access to the database using
zebra_chaintypes.
Structs§
- Finalized
State - The finalized part of the chain state, stored in the db.
Constants§
- STATE_
COLUMN_ FAMILIES_ IN_ CODE - The column families supported by the running
zebra-statedatabase code.