Skip to content

deps: bump to iroh@main and irpc@main #128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 30, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ self_cell = "1.1.0"
genawaiter = { version = "0.99.1", features = ["futures03"] }
iroh-base = "0.90"
reflink-copy = "0.1.24"
irpc = { version = "0.5.0", features = ["rpc", "quinn_endpoint_setup", "message_spans", "stream", "derive"], default-features = false }
irpc = { version = "0.5.0", features = ["rpc", "quinn_endpoint_setup", "spans", "stream", "derive"], default-features = false }
iroh-metrics = { version = "0.35" }

[dev-dependencies]
Expand All @@ -69,4 +69,3 @@ default = ["hide-proto-docs"]
iroh = { git = "https://github.com/n0-computer/iroh.git", branch = "main" }
iroh-base = { git = "https://github.com/n0-computer/iroh.git", branch = "main" }
irpc = { git = "https://github.com/n0-computer/irpc.git", branch = "main" }
irpc-derive = { git = "https://github.com/n0-computer/irpc.git", branch = "main" }
66 changes: 33 additions & 33 deletions src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use iroh::Endpoint;
use irpc::rpc::{listen, Handler};
use n0_snafu::SpanTrace;
use nested_enum_utils::common_fields;
use proto::{Request, ShutdownRequest, SyncDbRequest};
use proto::{BlobsApi, ShutdownRequest, SyncDbRequest};
use ref_cast::RefCast;
use serde::{Deserialize, Serialize};
use snafu::{Backtrace, IntoError, Snafu};
Expand All @@ -32,7 +32,7 @@ pub mod remote;
pub mod tags;
pub use crate::{store::util::Tag, util::temp_tag::TempTag};

pub(crate) type ApiClient = irpc::Client<proto::Command, proto::Request, proto::StoreService>;
pub(crate) type ApiClient = irpc::Client<proto::BlobsApi>;

#[common_fields({
backtrace: Option<Backtrace>,
Expand Down Expand Up @@ -281,43 +281,43 @@ impl Store {

/// Listen on a quinn endpoint for incoming rpc connections.
pub async fn listen(self, endpoint: quinn::Endpoint) {
let local = self.client.local().unwrap().clone();
let handler: Handler<Request> = Arc::new(move |req, rx, tx| {
let local = self.client.as_local().unwrap().clone();
let handler: Handler<BlobsApi> = Arc::new(move |req, rx, tx| {
let local = local.clone();
Box::pin({
match req {
Request::SetTag(msg) => local.send((msg, tx)),
Request::CreateTag(msg) => local.send((msg, tx)),
Request::DeleteTags(msg) => local.send((msg, tx)),
Request::RenameTag(msg) => local.send((msg, tx)),
Request::ListTags(msg) => local.send((msg, tx)),

Request::ListTempTags(msg) => local.send((msg, tx)),
Request::CreateTempTag(msg) => local.send((msg, tx)),

Request::BlobStatus(msg) => local.send((msg, tx)),

Request::ImportBytes(msg) => local.send((msg, tx)),
Request::ImportByteStream(msg) => local.send((msg, tx, rx)),
Request::ImportBao(msg) => local.send((msg, tx, rx)),
Request::ImportPath(msg) => local.send((msg, tx)),
Request::ListBlobs(msg) => local.send((msg, tx)),
Request::DeleteBlobs(msg) => local.send((msg, tx)),
Request::Batch(msg) => local.send((msg, tx, rx)),

Request::ExportBao(msg) => local.send((msg, tx)),
Request::ExportRanges(msg) => local.send((msg, tx)),
Request::ExportPath(msg) => local.send((msg, tx)),

Request::Observe(msg) => local.send((msg, tx)),

Request::ClearProtected(msg) => local.send((msg, tx)),
Request::SyncDb(msg) => local.send((msg, tx)),
Request::Shutdown(msg) => local.send((msg, tx)),
BlobsApi::SetTag(msg) => local.send((msg, tx)),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this forwarder boilerplate one of the things we can get rid of with the new features of the macro?

Just curious, perfectly reasonable to do this in a subsequent PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup! Removed in the latest commit.

BlobsApi::CreateTag(msg) => local.send((msg, tx)),
BlobsApi::DeleteTags(msg) => local.send((msg, tx)),
BlobsApi::RenameTag(msg) => local.send((msg, tx)),
BlobsApi::ListTags(msg) => local.send((msg, tx)),

BlobsApi::ListTempTags(msg) => local.send((msg, tx)),
BlobsApi::CreateTempTag(msg) => local.send((msg, tx)),

BlobsApi::BlobStatus(msg) => local.send((msg, tx)),

BlobsApi::ImportBytes(msg) => local.send((msg, tx)),
BlobsApi::ImportByteStream(msg) => local.send((msg, tx, rx)),
BlobsApi::ImportBao(msg) => local.send((msg, tx, rx)),
BlobsApi::ImportPath(msg) => local.send((msg, tx)),
BlobsApi::ListBlobs(msg) => local.send((msg, tx)),
BlobsApi::DeleteBlobs(msg) => local.send((msg, tx)),
BlobsApi::Batch(msg) => local.send((msg, tx, rx)),

BlobsApi::ExportBao(msg) => local.send((msg, tx)),
BlobsApi::ExportRanges(msg) => local.send((msg, tx)),
BlobsApi::ExportPath(msg) => local.send((msg, tx)),

BlobsApi::Observe(msg) => local.send((msg, tx)),

BlobsApi::ClearProtected(msg) => local.send((msg, tx)),
BlobsApi::SyncDb(msg) => local.send((msg, tx)),
BlobsApi::Shutdown(msg) => local.send((msg, tx)),
}
})
});
listen::<Request>(endpoint, handler).await
listen::<BlobsApi>(endpoint, handler).await
}

pub async fn sync_db(&self) -> RequestResult<()> {
Expand Down
9 changes: 2 additions & 7 deletions src/api/downloader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,10 @@ use crate::{

#[derive(Debug, Clone)]
pub struct Downloader {
client: irpc::Client<SwarmMsg, SwarmProtocol, DownloaderService>,
client: irpc::Client<SwarmProtocol>,
}

#[derive(Debug, Clone)]
pub struct DownloaderService;

impl irpc::Service for DownloaderService {}

#[rpc_requests(DownloaderService, message = SwarmMsg, alias = "Msg")]
#[rpc_requests(message = SwarmMsg, alias = "Msg")]
#[derive(Debug, Serialize, Deserialize)]
enum SwarmProtocol {
#[rpc(tx = mpsc::Sender<DownloadProgessItem>)]
Expand Down
8 changes: 2 additions & 6 deletions src/api/proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,9 @@ impl HashSpecific for CreateTagMsg {
}
}

#[derive(Debug, Clone)]
pub struct StoreService;
impl irpc::Service for StoreService {}

#[rpc_requests(StoreService, message = Command, alias = "Msg")]
#[rpc_requests(message = Command, alias = "Msg")]
#[derive(Debug, Serialize, Deserialize)]
pub enum Request {
pub enum BlobsApi {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not quite sure about this rename. Request as the enum of all possible serializable requests seems fine. And calling it BlobsApi creates a bit of confusion with the api module that has the actual friendly api.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't mind much. Renamed back to Request. As most things are not public that use this it's fine. My initial rename was from seeing irpc::Client<Request> and thinking "maybe better to rename to something that contains Blobs". But as this is all private it really is fine as it is.

#[rpc(tx = mpsc::Sender<super::Result<Hash>>)]
ListBlobs(ListRequest),
#[rpc(tx = oneshot::Sender<Scope>, rx = mpsc::Receiver<BatchResponse>)]
Expand Down
2 changes: 1 addition & 1 deletion src/store/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1259,7 +1259,7 @@ impl AsRef<Store> for FsStore {

impl FsStore {
fn new(
sender: irpc::LocalSender<proto::Command, proto::StoreService>,
sender: irpc::LocalSender<proto::BlobsApi>,
db: tokio::sync::mpsc::Sender<InternalCommand>,
) -> Self {
Self {
Expand Down
10 changes: 5 additions & 5 deletions src/store/fs/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ use crate::{
api::{
blobs::{AddProgressItem, ImportMode},
proto::{
HashSpecific, ImportByteStreamMsg, ImportByteStreamRequest, ImportByteStreamUpdate,
ImportBytesMsg, ImportBytesRequest, ImportPathMsg, ImportPathRequest, Scope,
StoreService,
BlobsApi, HashSpecific, ImportByteStreamMsg, ImportByteStreamRequest,
ImportByteStreamUpdate, ImportBytesMsg, ImportBytesRequest, ImportPathMsg,
ImportPathRequest, Scope,
},
},
store::{
Expand Down Expand Up @@ -136,12 +136,12 @@ impl std::fmt::Debug for ImportEntry {
}
}

impl Channels<StoreService> for ImportEntry {
impl Channels<BlobsApi> for ImportEntry {
type Tx = mpsc::Sender<AddProgressItem>;
type Rx = NoReceiver;
}

pub type ImportEntryMsg = WithChannels<ImportEntry, StoreService>;
pub type ImportEntryMsg = WithChannels<ImportEntry, BlobsApi>;

impl HashSpecific for ImportEntryMsg {
fn hash(&self) -> Hash {
Expand Down
Loading