Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/rpc/client/blobs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ use iroh::NodeAddr;
use portable_atomic::{AtomicU64, Ordering};
use quic_rpc::{
client::{BoxStreamSync, BoxedConnector},
transport::boxed::BoxableConnector,
Connector, RpcClient,
};
use serde::{Deserialize, Serialize};
Expand All @@ -87,7 +88,7 @@ use crate::{
format::collection::{Collection, SimpleStore},
get::db::DownloadProgress as BytesDownloadProgress,
net_protocol::BlobDownloadRequest,
rpc::proto::RpcService,
rpc::proto::{Request, Response, RpcService},
store::{BaoBlobSize, ConsistencyCheckProgress, ExportFormat, ExportMode, ValidateProgress},
util::SetTagOption,
BlobFormat, Hash, Tag,
Expand All @@ -108,7 +109,7 @@ use crate::rpc::proto::blobs::{
#[derive(Debug, Clone)]
#[repr(transparent)]
pub struct Client<C = BoxedConnector<RpcService>> {
pub(super) rpc: RpcClient<RpcService, C>,
pub(crate) rpc: RpcClient<RpcService, C>,
}

/// Type alias for a memory-backed client.
Expand All @@ -123,6 +124,14 @@ where
Self { rpc }
}

/// Box the client to avoid having to provide the connector type.
pub fn boxed(&self) -> Client<BoxedConnector<RpcService>>
where
C: BoxableConnector<Response, Request>,
{
Client::new(self.rpc.clone().boxed())
}

/// Get a tags client.
pub fn tags(&self) -> tags::Client<C> {
tags::Client::new(self.rpc.clone())
Expand Down
Loading