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_chain
types 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::OutputIndex;
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::SaplingScannedDatabaseEntry;
pub use disk_format::SaplingScannedDatabaseIndex;
pub use disk_format::SaplingScannedResult;
pub use disk_format::SaplingScanningKey;
pub use disk_format::KV;
Modules§
- Arbitrary value generation and test harnesses for the finalized state.
- Type-safe column family access.
- disk_db 🔒Provides low-level access to RocksDB using some database-specific types.
- Serialization formats for finalized data.
- zebra_
db 🔒Provides high-level access to the database usingzebra_chain
types.
Structs§
- The finalized part of the chain state, stored in the db.
Constants§
- The column families supported by the running
zebra-state
database code.