penumbra_sdk_app/server/
snapshot.rs1use std::{
2 future::Future,
3 pin::Pin,
4 task::{Context, Poll},
5};
6
7use futures::FutureExt;
8use tendermint::v0_37::abci::{SnapshotRequest, SnapshotResponse};
9use tower_abci::BoxError;
10
11#[derive(Clone, Debug)]
12pub struct Snapshot {}
13
14impl tower_service::Service<SnapshotRequest> for Snapshot {
15 type Response = SnapshotResponse;
16 type Error = BoxError;
17 type Future =
18 Pin<Box<dyn Future<Output = Result<SnapshotResponse, BoxError>> + Send + 'static>>;
19
20 fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
21 Poll::Ready(Ok(()))
22 }
23
24 fn call(&mut self, req: SnapshotRequest) -> Self::Future {
25 use SnapshotRequest as Request;
27 use SnapshotResponse as Response;
28 async move {
29 Ok(match req {
30 Request::ListSnapshots => Response::ListSnapshots(Default::default()),
31 Request::OfferSnapshot(_) => Response::OfferSnapshot(Default::default()),
32 Request::LoadSnapshotChunk(_) => Response::LoadSnapshotChunk(Default::default()),
33 Request::ApplySnapshotChunk(_) => Response::ApplySnapshotChunk(Default::default()),
34 })
35 }
36 .boxed()
37 }
38}