Expand description
[tower::Service]s for Zebra’s cached chain state.
Zebra provides cached state access via two main services:
StateService: a read-write service that writes blocks to the state, and redirects most read requests to theReadStateService.ReadStateService: a read-only service that answers from the most recent committed block.
Most users should prefer ReadStateService, unless they need to write blocks to the state.
Zebra also provides access to the best chain tip via:
LatestChainTip: a read-only channel that contains the latest committed tip.ChainTipChange: a read-only channel that can asynchronously await chain tip changes.
Re-exports§
pub use finalized_state::OutputLocation;pub use finalized_state::TransactionIndex;pub use finalized_state::TransactionLocation;
Modules§
- arbitrary
- Arbitrary data generation and test setup for Zebra’s state.
- block_
iter - Iterators for blocks in the non-finalized and finalized state.
- chain_
tip - Access to Zebra chain tip information.
- check
- Consensus critical contextual checks
- finalized_
state 🔒 - The primary implementation of the
zebra_state::Servicebuilt upon rocksdb. - non_
finalized_ 🔒state - Non-finalized chain state management as defined by RFC0005
- pending_
utxos 🔒 - Pending UTXO tracker for
AwaitUtxorequests. - queued_
blocks 🔒 - Queued blocks that are awaiting their parent block for verification.
- read 🔒
- Shared state reading code.
- watch_
receiver - Shared [
tokio::sync::watch] channel wrappers. - write 🔒
- Writing blocks to the finalized and non-finalized states.
Structs§
- Read
State Service - A read-only service for accessing Zebra’s cached blockchain state.
- State
Service 🔒 - A read-write service for Zebra’s cached blockchain state.
Functions§
- init
- Initialize a state service from the provided
Config. Returns a boxed state service, a read-only state service, and receivers for state chain tip updates. - init_
read_ only - Initialize a read state service from the provided
Config. Returns a read-only state service, - init_
test - Returns a
StateServicewith an ephemeralConfigand a buffer with a single slot. - init_
test_ services - Initializes a state service with an ephemeral
Configand a buffer with a single slot, then returns the read-write service, read-only service, and tip watch channels. - spawn_
init_ read_ only - Calls
init_read_onlywith the providedConfigandNetworkfrom a blocking task. Returns a [tokio::task::JoinHandle] with a read state service and chain tip sender.