pub trait Snapshot {
fn echo(&self, echo_request: RequestEcho) -> ResponseEcho { ... }
fn list_snapshots(
&self,
_list_snapshots_request: RequestListSnapshots
) -> ResponseListSnapshots { ... }
fn offer_snapshot(
&self,
_offer_snapshot_request: RequestOfferSnapshot
) -> ResponseOfferSnapshot { ... }
fn load_snapshot_chunk(
&self,
_load_snapshot_chunk_request: RequestLoadSnapshotChunk
) -> ResponseLoadSnapshotChunk { ... }
fn apply_snapshot_chunk(
&self,
_apply_snapshot_chunk_request: RequestApplySnapshotChunk
) -> ResponseApplySnapshotChunk { ... }
fn flush(&self, _flush_request: RequestFlush) -> ResponseFlush { ... }
}
sync-api
only.Expand description
Trait for serving and restoring tendermint’s state sync snapshots.
Details
State sync allows new nodes to rapidly bootstrap by discovering, fetching, and applying state machine snapshots instead of replaying historical blocks. For more details, see the state sync section.
When a new node is discovering snapshots in the P2P network, existing nodes will call
list_snapshots
on the application to retrieve any local state snapshots. The new node will
offer these snapshots to its local application via offer_snapshot
.
Once the application accepts a snapshot and begins restoring it, Tendermint will fetch snapshot
chunks from existing nodes via load_snapshot_chunk
and apply them sequentially to the local
application with apply_snapshot_chunk
. When all chunks have been applied, the application
app_hash
is retrieved via an info
query and compared to the blockchain’s app_hash
verified via light client.
Provided Methods
sourcefn echo(&self, echo_request: RequestEcho) -> ResponseEcho
fn echo(&self, echo_request: RequestEcho) -> ResponseEcho
Echo a string to test abci client/server implementation.
sourcefn list_snapshots(
&self,
_list_snapshots_request: RequestListSnapshots
) -> ResponseListSnapshots
fn list_snapshots(
&self,
_list_snapshots_request: RequestListSnapshots
) -> ResponseListSnapshots
Used during state sync to discover available snapshots on peers.
sourcefn offer_snapshot(
&self,
_offer_snapshot_request: RequestOfferSnapshot
) -> ResponseOfferSnapshot
fn offer_snapshot(
&self,
_offer_snapshot_request: RequestOfferSnapshot
) -> ResponseOfferSnapshot
OfferSnapshot is called when bootstrapping a node using state sync.
sourcefn load_snapshot_chunk(
&self,
_load_snapshot_chunk_request: RequestLoadSnapshotChunk
) -> ResponseLoadSnapshotChunk
fn load_snapshot_chunk(
&self,
_load_snapshot_chunk_request: RequestLoadSnapshotChunk
) -> ResponseLoadSnapshotChunk
Used during state sync to retrieve snapshot chunks from peers.
sourcefn apply_snapshot_chunk(
&self,
_apply_snapshot_chunk_request: RequestApplySnapshotChunk
) -> ResponseApplySnapshotChunk
fn apply_snapshot_chunk(
&self,
_apply_snapshot_chunk_request: RequestApplySnapshotChunk
) -> ResponseApplySnapshotChunk
Applies the snapshot chunks received from load_snapshot_chunk
sourcefn flush(&self, _flush_request: RequestFlush) -> ResponseFlush
fn flush(&self, _flush_request: RequestFlush) -> ResponseFlush
Signals that messages queued on the client should be flushed to the server.