diff --git a/src/rpc.rs b/src/rpc.rs index 46f10dc..d1e974a 100644 --- a/src/rpc.rs +++ b/src/rpc.rs @@ -1,9 +1,8 @@ //! Quic RPC implementation for docs. -use proto::{Request, Response, RpcService}; +use proto::{Request, RpcService}; use quic_rpc::{ server::{ChannelTypes, RpcChannel}, - transport::flume::FlumeConnector, RpcClient, RpcServer, }; use tokio_util::task::AbortOnDropHandle; @@ -20,7 +19,7 @@ type RpcResult = std::result::Result; impl Engine { /// Get an in memory client to interact with the docs engine. - pub fn client(&self) -> &client::docs::Client> { + pub fn client(&self) -> &client::docs::MemClient { &self .rpc_handler .get_or_init(|| RpcHandler::new(self)) @@ -81,7 +80,7 @@ impl Engine { #[derive(Debug)] pub(crate) struct RpcHandler { /// Client to hand out - client: client::docs::Client>, + client: client::docs::MemClient, /// Handler task _handler: AbortOnDropHandle<()>, } @@ -91,7 +90,7 @@ impl RpcHandler { let engine = engine.clone(); let (listener, connector) = quic_rpc::transport::flume::channel(1); let listener = RpcServer::new(listener); - let client = client::docs::Client::new(RpcClient::new(connector)); + let client = client::docs::MemClient::new(RpcClient::new(connector)); let _handler = listener .spawn_accept_loop(move |req, chan| engine.clone().handle_rpc_request(req, chan)); Self { client, _handler } diff --git a/src/rpc/client/docs.rs b/src/rpc/client/docs.rs index a6e5d00..6f40409 100644 --- a/src/rpc/client/docs.rs +++ b/src/rpc/client/docs.rs @@ -16,7 +16,9 @@ use iroh_base::node_addr::AddrInfoOptions; use iroh_blobs::{export::ExportProgress, store::ExportMode, Hash}; use iroh_net::NodeAddr; use portable_atomic::{AtomicBool, Ordering}; -use quic_rpc::{client::BoxedConnector, message::RpcMsg, Connector}; +use quic_rpc::{ + client::BoxedConnector, message::RpcMsg, transport::flume::FlumeConnector, Connector, +}; use serde::{Deserialize, Serialize}; use super::{authors, flatten}; @@ -38,6 +40,10 @@ pub use crate::{ Entry, }; +/// Type alias for a memory-backed client. +pub type MemClient = + Client>; + /// Iroh docs client. #[derive(Debug, Clone)] #[repr(transparent)]