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
29
30
31
32
33
34
35
36
//! RPC protocol for the iroh-blobs service
use nested_enum_utils::enum_conversions;
use serde::{Deserialize, Serialize};

pub mod blobs;
pub mod tags;

/// quic-rpc service for iroh blobs
#[derive(Debug, Clone)]
pub struct RpcService;

impl quic_rpc::Service for RpcService {
    type Req = Request;
    type Res = Response;
}

#[allow(missing_docs)]
#[enum_conversions]
#[derive(Debug, Serialize, Deserialize)]
pub enum Request {
    Blobs(blobs::Request),
    Tags(tags::Request),
}

#[allow(missing_docs)]
#[enum_conversions]
#[derive(Debug, Serialize, Deserialize)]
pub enum Response {
    Blobs(blobs::Response),
    Tags(tags::Response),
}

/// Error type for RPC operations
pub type RpcError = serde_error::Error;
/// Result type for RPC operations
pub type RpcResult<T> = Result<T, RpcError>;