Skip to main content

vote_commitment_tree_client/
transport.rs

1//! Small blocking transport abstraction for vote commitment tree sync.
2
3/// Response returned by a tree-sync transport request.
4#[derive(Clone, Debug, Eq, PartialEq)]
5pub struct TransportResponse {
6    pub status: u16,
7    pub body: Vec<u8>,
8}
9
10/// Errors returned by a concrete tree-sync transport implementation.
11#[derive(Clone, Debug, Eq, PartialEq, thiserror::Error)]
12pub enum TransportError {
13    #[error("request failed: {0}")]
14    Request(String),
15}
16
17/// Blocking GET-only transport used by [`crate::http_sync_api::HttpTreeSyncApi`].
18pub trait Transport: Send + Sync {
19    fn get(&self, url: &str) -> Result<TransportResponse, TransportError>;
20}