1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use std::any::Any;

use anyhow::Result;

use crate::storage::mkvs::sync::{
    GetPrefixesRequest, GetRequest, IterateRequest, ProofResponse, ReadSync, SyncerError,
};

/// A no-op read syncer which doesn't support any of the required operations.
pub struct NoopReadSyncer;

impl ReadSync for NoopReadSyncer {
    fn as_any(&self) -> &dyn Any {
        self
    }

    fn sync_get(&mut self, _request: GetRequest) -> Result<ProofResponse> {
        Err(SyncerError::Unsupported.into())
    }

    fn sync_get_prefixes(&mut self, _request: GetPrefixesRequest) -> Result<ProofResponse> {
        Err(SyncerError::Unsupported.into())
    }

    fn sync_iterate(&mut self, _request: IterateRequest) -> Result<ProofResponse> {
        Err(SyncerError::Unsupported.into())
    }
}