pub trait Snapshot: Send + Sync {
// Provided methods
fn echo<'life0, 'async_trait>(
&'life0 self,
echo_request: RequestEcho,
) -> Pin<Box<dyn Future<Output = ResponseEcho> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn list_snapshots<'life0, 'async_trait>(
&'life0 self,
_list_snapshots_request: RequestListSnapshots,
) -> Pin<Box<dyn Future<Output = ResponseListSnapshots> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn offer_snapshot<'life0, 'async_trait>(
&'life0 self,
_offer_snapshot_request: RequestOfferSnapshot,
) -> Pin<Box<dyn Future<Output = ResponseOfferSnapshot> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn load_snapshot_chunk<'life0, 'async_trait>(
&'life0 self,
_load_snapshot_chunk_request: RequestLoadSnapshotChunk,
) -> Pin<Box<dyn Future<Output = ResponseLoadSnapshotChunk> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn apply_snapshot_chunk<'life0, 'async_trait>(
&'life0 self,
_apply_snapshot_chunk_request: RequestApplySnapshotChunk,
) -> Pin<Box<dyn Future<Output = ResponseApplySnapshotChunk> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn flush<'life0, 'async_trait>(
&'life0 self,
_flush_request: RequestFlush,
) -> Pin<Box<dyn Future<Output = ResponseFlush> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}
async-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.