Skip to content

Commit 8d0af32

Browse files
committed
fix fix fix fix
1 parent 8e0adef commit 8d0af32

35 files changed

+492
-380
lines changed

Cargo.lock

Lines changed: 4 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@ derive_more = { version = "2.0.1", features = ["from", "try_from", "into", "debu
1919
futures-lite = "2.6.0"
2020
quinn = { package = "iroh-quinn", version = "0.14.0" }
2121
n0-future = "0.3.0"
22-
n0-snafu = "0.2.2"
2322
range-collections = { version = "0.4.6", features = ["serde"] }
2423
smallvec = { version = "1", features = ["serde", "const_new"] }
25-
snafu = "0.8.5"
2624
tokio = { version = "1.43.0", features = ["full"] }
2725
tokio-util = { version = "0.7.13", features = ["full"] }
2826
tracing = "0.1.41"
@@ -33,7 +31,6 @@ serde = "1.0.217"
3331
postcard = { version = "1.1.1", features = ["experimental-derive", "use-std"] }
3432
data-encoding = "2.8.0"
3533
chrono = "0.4.39"
36-
nested_enum_utils = "0.2.1"
3734
ref-cast = "1.0.24"
3835
arrayvec = "0.7.6"
3936
iroh = "0.94"
@@ -75,4 +72,4 @@ fs-store = ["dep:redb", "dep:reflink-copy"]
7572
iroh = { git = "https://github.com/n0-computer/iroh.git", branch = "main" }
7673
iroh-base = { git = "https://github.com/n0-computer/iroh.git", branch = "main" }
7774
irpc = { git = "https://github.com/n0-computer/irpc.git", branch = "matheus23/irpc-n0-error" }
78-
n0-error = { git = "https://github.com/n0-computer/n0-error.git", branch = "Frando/anyhow-ext" }
75+
n0-error = { git = "https://github.com/n0-computer/n0-error.git", branch = "Frando/arc-stack" }

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ use iroh::{protocol::Router, Endpoint};
3737
use iroh_blobs::{store::mem::MemStore, BlobsProtocol, ticket::BlobTicket};
3838
3939
#[tokio::main]
40-
async fn main() -> anyhow::Result<()> {
40+
async fn main() -> n0_error::Result<()> {
4141
// create an iroh endpoint that includes the standard discovery mechanisms
4242
// we've built at number0
4343
let endpoint = Endpoint::bind().await?;

examples/common/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
#![allow(dead_code)]
2-
use anyhow::Result;
32
use iroh::SecretKey;
3+
use n0_error::{Result, StackResultExt};
44
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, EnvFilter};
55

66
/// Gets a secret key from the IROH_SECRET environment variable or generates a new random one.
77
/// If the environment variable is set, it must be a valid string representation of a secret key.
88
pub fn get_or_generate_secret_key() -> Result<SecretKey> {
99
use std::{env, str::FromStr};
1010

11-
use anyhow::Context;
1211
if let Ok(secret) = env::var("IROH_SECRET") {
1312
// Parse the secret key from string
1413
SecretKey::from_str(&secret).context("Invalid secret key format")

examples/compression.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
mod common;
66
use std::{fmt::Debug, path::PathBuf};
77

8-
use anyhow::Result;
8+
use n0_error::Result;
99
use clap::Parser;
1010
use common::setup_logging;
1111
use iroh::protocol::ProtocolHandler;

examples/custom-protocol.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ use std::{
4040
sync::{Arc, Mutex},
4141
};
4242

43-
use anyhow::Result;
43+
use n0_error::Result;
4444
use clap::Parser;
4545
use iroh::{
4646
discovery::pkarr::PkarrResolver,

examples/expiring-tags.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ async fn create_expiring_tag(
3030
hashes: &[Hash],
3131
prefix: &str,
3232
expiry: SystemTime,
33-
) -> anyhow::Result<()> {
33+
) -> n0_error::Result<()> {
3434
let expiry = chrono::DateTime::<chrono::Utc>::from(expiry);
3535
let expiry = expiry.to_rfc3339_opts(chrono::SecondsFormat::Secs, true);
3636
let tagname = format!("{prefix}-{expiry}");
@@ -53,7 +53,7 @@ async fn create_expiring_tag(
5353
Ok(())
5454
}
5555

56-
async fn delete_expired_tags(blobs: &Store, prefix: &str, bulk: bool) -> anyhow::Result<()> {
56+
async fn delete_expired_tags(blobs: &Store, prefix: &str, bulk: bool) -> n0_error::Result<()> {
5757
let prefix = format!("{prefix}-");
5858
let now = chrono::Utc::now();
5959
let end = format!(
@@ -100,7 +100,7 @@ async fn delete_expired_tags(blobs: &Store, prefix: &str, bulk: bool) -> anyhow:
100100
Ok(())
101101
}
102102

103-
async fn print_store_info(store: &Store) -> anyhow::Result<()> {
103+
async fn print_store_info(store: &Store) -> n0_error::Result<()> {
104104
let now = chrono::Utc::now();
105105
let mut tags = store.tags().list().await?;
106106
println!(
@@ -121,23 +121,23 @@ async fn print_store_info(store: &Store) -> anyhow::Result<()> {
121121
Ok(())
122122
}
123123

124-
async fn info_task(store: Store) -> anyhow::Result<()> {
124+
async fn info_task(store: Store) -> n0_error::Result<()> {
125125
tokio::time::sleep(Duration::from_secs(1)).await;
126126
loop {
127127
print_store_info(&store).await?;
128128
tokio::time::sleep(Duration::from_secs(5)).await;
129129
}
130130
}
131131

132-
async fn delete_expired_tags_task(store: Store, prefix: &str) -> anyhow::Result<()> {
132+
async fn delete_expired_tags_task(store: Store, prefix: &str) -> n0_error::Result<()> {
133133
loop {
134134
delete_expired_tags(&store, prefix, false).await?;
135135
tokio::time::sleep(Duration::from_secs(5)).await;
136136
}
137137
}
138138

139139
#[tokio::main]
140-
async fn main() -> anyhow::Result<()> {
140+
async fn main() -> n0_error::Result<()> {
141141
tracing_subscriber::fmt::init();
142142
let path = std::env::current_dir()?.join("blobs");
143143
let options = Options {

examples/get-blob.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ pub struct Cli {
2525
}
2626

2727
#[tokio::main]
28-
async fn main() -> anyhow::Result<()> {
28+
async fn main() -> n0_error::Result<()> {
2929
setup_logging();
3030
let cli = Cli::parse();
3131
let ticket = cli.ticket;
3232
let endpoint = iroh::Endpoint::empty_builder(iroh::RelayMode::Default)
3333
.discovery(PkarrResolver::n0_dns())
3434
.bind()
3535
.await?;
36-
anyhow::ensure!(
36+
n0_error::ensure!(
3737
ticket.format() == BlobFormat::Raw,
3838
"This example only supports raw blobs."
3939
);
@@ -54,10 +54,10 @@ async fn main() -> anyhow::Result<()> {
5454
break stats;
5555
}
5656
Some(GetBlobItem::Error(err)) => {
57-
anyhow::bail!("Error while streaming blob: {err}");
57+
n0_error::bail!("Error while streaming blob: {err}");
5858
}
5959
None => {
60-
anyhow::bail!("Stream ended unexpectedly.");
60+
n0_error::bail!("Stream ended unexpectedly.");
6161
}
6262
}
6363
}

examples/limit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use std::{
1818
},
1919
};
2020

21-
use anyhow::Result;
21+
use n0_error::Result;
2222
use clap::Parser;
2323
use common::setup_logging;
2424
use iroh::{protocol::Router, EndpointAddr, EndpointId, SecretKey};

examples/mdns-discovery.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
//! Run that command on another machine in the same local network, replacing [FILE_PATH] to the path on which you want to save the transferred content.
1414
use std::path::{Path, PathBuf};
1515

16-
use anyhow::{ensure, Result};
16+
use n0_error::{ensure, Result};
1717
use clap::{Parser, Subcommand};
1818
use iroh::{
1919
discovery::mdns::MdnsDiscovery, protocol::Router, Endpoint, PublicKey, RelayMode, SecretKey,
@@ -127,7 +127,7 @@ async fn connect(node_id: PublicKey, hash: Hash, out: Option<PathBuf>) -> Result
127127
}
128128

129129
#[tokio::main]
130-
async fn main() -> anyhow::Result<()> {
130+
async fn main() -> n0_error::Result<()> {
131131
setup_logging();
132132
let cli = Cli::parse();
133133

0 commit comments

Comments
 (0)