Module zebra_state::service
source · 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::OutputIndex;
pub use finalized_state::OutputLocation;
pub use finalized_state::TransactionIndex;
pub use finalized_state::TransactionLocation;
Modules§
- Arbitrary data generation and test setup for Zebra’s state.
- Iterators for blocks in the non-finalized and finalized state.
- Access to Zebra chain tip information.
- Consensus critical contextual checks
- The primary implementation of the
zebra_state::Service
built upon rocksdb. - Non-finalized chain state management as defined by RFC0005
- Pending UTXO tracker for
AwaitUtxo
requests. - Queued blocks that are awaiting their parent block for verification.
- read 🔒Shared state reading code.
- Shared [
tokio::sync::watch
] channel wrappers. - write 🔒Writing blocks to the finalized and non-finalized states.
Structs§
- A read-only service for accessing Zebra’s cached blockchain state.
- A read-write service for Zebra’s cached blockchain state.
Functions§
- 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. - Initialize a read state service from the provided
Config
. Returns a read-only state service, - Returns a
StateService
with an ephemeralConfig
and a buffer with a single slot. - Initializes a state service with an ephemeral
Config
and a buffer with a single slot, then returns the read-write service, read-only service, and tip watch channels. - Calls
init_read_only
with the providedConfig
andNetwork
from a blocking task. Returns a [tokio::task::JoinHandle
] with a read state service and chain tip sender.