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:

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§

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 ephemeral Config 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 with the provided Config and Network from a blocking task. Returns a [tokio::task::JoinHandle] with a boxed state service, a read state service, and receivers for state chain tip updates.
  • Calls init_read_only with the provided Config and Network from a blocking task. Returns a [tokio::task::JoinHandle] with a read state service and chain tip sender.