From d1a8d3946f25c9a408613a1b84cf87f0f9139b40 Mon Sep 17 00:00:00 2001 From: dignifiedquire Date: Mon, 16 Dec 2024 17:34:00 +0100 Subject: [PATCH 01/13] feat: update to iroh@0.30.0 --- Cargo.lock | 506 ++++++++++++++++++--------------- src/actor.rs | 2 +- src/cli.rs | 32 ++- src/cli/authors.rs | 7 +- src/engine.rs | 2 +- src/engine/gossip.rs | 6 +- src/engine/live.rs | 4 +- src/net.rs | 2 +- src/net/codec.rs | 13 +- src/rpc.rs | 64 +++++ src/rpc/client/docs.rs | 17 +- src/rpc/docs_handle_request.rs | 4 +- src/rpc/proto.rs | 4 +- src/store/fs.rs | 2 +- src/store/fs/query.rs | 2 +- src/sync.rs | 2 +- src/ticket.rs | 5 +- tests/sync.rs | 18 +- tests/util.rs | 2 +- 19 files changed, 403 insertions(+), 291 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index edc69eaa..b4c0b66e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -119,6 +119,12 @@ version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1fd03a028ef38ba2276dce7e33fcd6369c158a1bca17946c4b1b701891c1ff7" +[[package]] +name = "arc-swap" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" + [[package]] name = "arrayref" version = "0.3.9" @@ -253,7 +259,7 @@ dependencies = [ "serde_json", "serde_path_to_error", "serde_urlencoded", - "sync_wrapper 1.0.2", + "sync_wrapper", "tokio", "tower", "tower-layer", @@ -276,7 +282,7 @@ dependencies = [ "mime", "pin-project-lite", "rustversion", - "sync_wrapper 1.0.2", + "sync_wrapper", "tower-layer", "tower-service", "tracing", @@ -351,18 +357,18 @@ checksum = "597bb81c80a54b6a4381b23faba8d7774b144c94cbd1d6fe3f1329bd776554ab" [[package]] name = "bit-set" -version = "0.5.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" dependencies = [ "bit-vec", ] [[package]] name = "bit-vec" -version = "0.6.3" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" [[package]] name = "bitflags" @@ -445,9 +451,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.2" +version = "1.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f34d93e62b03caf570cccc334cbc6c2fceca82f39211051345108adcba3eebdc" +checksum = "9157bbaa6b165880c27a4293a474c91cdcf265cc68cc829bf10be0964a391caf" dependencies = [ "shlex", ] @@ -483,9 +489,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.38" +version = "0.4.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" dependencies = [ "android-tzdata", "iana-time-zone", @@ -509,9 +515,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.22" +version = "4.5.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69371e34337c4c984bbe322360c2547210bf632eb2814bbe78a6e87a2935bd2b" +checksum = "3135e7ec2ef7b10c6ed8950f0f792ed96ee093fa088608f1c76e569722700c84" dependencies = [ "clap_builder", "clap_derive", @@ -519,9 +525,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.22" +version = "4.5.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e24c1b4099818523236a8ca881d2b45db98dadfb4625cf6608c12069fcbbde1" +checksum = "30582fc632330df2bd26877bde0c1f4470d57c582bbc070376afcd04d8cb4838" dependencies = [ "anstream", "anstyle", @@ -543,9 +549,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afb84c814227b90d6895e01398aee0d8033c00e7466aca416fb6a8e0eb19d8a7" +checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" [[package]] name = "cobs" @@ -561,12 +567,12 @@ checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "colored" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" +checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c" dependencies = [ "lazy_static", - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] @@ -590,15 +596,15 @@ dependencies = [ [[package]] name = "console" -version = "0.15.8" +version = "0.15.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" +checksum = "ea3c6ecd8059b57859df5c69830340ed3c41d30e3da0c1cbed90a96ac853041b" dependencies = [ "encode_unicode", - "lazy_static", "libc", - "unicode-width 0.1.14", - "windows-sys 0.52.0", + "once_cell", + "unicode-width", + "windows-sys 0.59.0", ] [[package]] @@ -663,11 +669,29 @@ version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" +[[package]] +name = "crossbeam-channel" +version = "0.5.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06ba6d68e24814cb8de6bb986db8222d3a027d15872cabc0d18817bc3c0e4471" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "crossbeam-utils" -version = "0.8.20" +version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" [[package]] name = "crypto-bigint" @@ -735,7 +759,9 @@ dependencies = [ "curve25519-dalek-derive", "digest", "fiat-crypto", + "rand_core", "rustc_version", + "serde", "subtle", "zeroize", ] @@ -1006,9 +1032,9 @@ checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" [[package]] name = "encode_unicode" -version = "0.3.6" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" +checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0" [[package]] name = "enum-as-inner" @@ -1073,17 +1099,6 @@ dependencies = [ "windows-sys 0.59.0", ] -[[package]] -name = "event-listener" -version = "4.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67b215c49b2b248c855fb73579eb1f4f26c38ffdc12973e20e07b91d78d5646e" -dependencies = [ - "concurrent-queue", - "parking", - "pin-project-lite", -] - [[package]] name = "event-listener" version = "5.3.1" @@ -1101,7 +1116,7 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c3e4e0dd3673c1139bf041f3008816d9cf2946bbfac2945c09e523b8d7b05b2" dependencies = [ - "event-listener 5.3.1", + "event-listener", "pin-project-lite", ] @@ -1122,9 +1137,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "ff" @@ -1271,7 +1286,7 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cef40d21ae2c515b51041df9ed313ed21e572df340ea58a922a0aefe7e8891a1" dependencies = [ - "fastrand 2.2.0", + "fastrand 2.3.0", "futures-core", "futures-io", "parking", @@ -1500,9 +1515,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hickory-proto" -version = "0.25.0-alpha.2" +version = "0.25.0-alpha.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8270a1857fb962b9914aafd46a89a187a4e63d0eb4190c327e7c7b8256a2d055" +checksum = "d063c0692ee669aa6d261988aa19ca5510f1cc40e4f211024f50c888499a35d7" dependencies = [ "async-recursion", "async-trait", @@ -1512,12 +1527,11 @@ dependencies = [ "futures-channel", "futures-io", "futures-util", - "idna 0.5.0", + "idna", "ipnet", "once_cell", "rand", - "thiserror 1.0.69", - "time", + "thiserror 2.0.7", "tinyvec", "tokio", "tracing", @@ -1526,21 +1540,21 @@ dependencies = [ [[package]] name = "hickory-resolver" -version = "0.25.0-alpha.2" +version = "0.25.0-alpha.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c110355b5703070d9e29c344d79818a7cde3de9c27fc35750defea6074b0ad" +checksum = "42bc352e4412fb657e795f79b4efcf2bd60b59ee5ca0187f3554194cd1107a27" dependencies = [ "cfg-if", "futures-util", "hickory-proto", "ipconfig", - "lru-cache", + "moka", "once_cell", "parking_lot", "rand", "resolv-conf", "smallvec", - "thiserror 1.0.69", + "thiserror 2.0.7", "tokio", "tracing", ] @@ -1566,9 +1580,9 @@ dependencies = [ [[package]] name = "hmac-sha256" -version = "1.1.7" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3688e69b38018fec1557254f64c8dc2cc8ec502890182f395dbb0aa997aa5735" +checksum = "4a8575493d277c9092b988c780c94737fb9fd8651a1001e16bee3eccfc1baedb" [[package]] name = "hostname" @@ -1854,16 +1868,6 @@ dependencies = [ "syn 2.0.90", ] -[[package]] -name = "idna" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - [[package]] name = "idna" version = "1.0.3" @@ -1926,7 +1930,7 @@ dependencies = [ "number_prefix", "portable-atomic", "tokio", - "unicode-width 0.2.0", + "unicode-width", "web-time", ] @@ -1978,25 +1982,26 @@ checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" [[package]] name = "iroh" version = "0.29.0" -source = "git+https://github.com/n0-computer/iroh?branch=main#321d8ffd3d2bde2f1a80e78eab1ad83687484fc2" +source = "git+https://github.com/n0-computer/iroh?branch=main#1ba140f143a472821f989aa9d05b057909bbc6fd" dependencies = [ + "aead", "anyhow", "axum", "backoff", "base64", "bytes", "concurrent-queue", + "crypto_box", + "data-encoding", "der", "derive_more", + "ed25519-dalek", "futures-buffered", "futures-concurrency", "futures-lite 2.5.0", "futures-sink", "futures-util", - "genawaiter", "governor", - "hex", - "hickory-proto", "hickory-resolver", "hostname 0.4.0", "http 1.2.0", @@ -2020,7 +2025,6 @@ dependencies = [ "netwatch", "num_enum", "once_cell", - "parking_lot", "pin-project", "pkarr", "portmapper", @@ -2039,7 +2043,7 @@ dependencies = [ "strum", "stun-rs", "surge-ping", - "thiserror 2.0.4", + "thiserror 2.0.7", "time", "tokio", "tokio-rustls", @@ -2049,7 +2053,6 @@ dependencies = [ "tokio-util", "tracing", "url", - "watchable", "webpki-roots", "windows 0.58.0", "wmi", @@ -2060,28 +2063,18 @@ dependencies = [ [[package]] name = "iroh-base" version = "0.29.0" -source = "git+https://github.com/n0-computer/iroh?branch=main#321d8ffd3d2bde2f1a80e78eab1ad83687484fc2" +source = "git+https://github.com/n0-computer/iroh?branch=main#1ba140f143a472821f989aa9d05b057909bbc6fd" dependencies = [ - "aead", - "anyhow", - "crypto_box", + "curve25519-dalek", "data-encoding", "derive_more", "ed25519-dalek", "getrandom", - "hex", - "iroh-blake3", - "once_cell", "postcard", - "rand", "rand_core", - "redb 2.2.0", "serde", - "ssh-key", - "thiserror 2.0.4", - "ttl_cache", + "thiserror 2.0.7", "url", - "zeroize", ] [[package]] @@ -2100,13 +2093,14 @@ dependencies = [ [[package]] name = "iroh-blobs" version = "0.29.0" -source = "git+https://github.com/n0-computer/iroh-blobs?branch=main#dba7850ae874939bd9a83f97c36dc6eceee7f9bd" +source = "git+https://github.com/n0-computer/iroh-blobs?branch=iroh-v0-30-0#3d558aa8e8789737a2da34b24e75c14fcc192b2d" dependencies = [ "anyhow", "async-channel", "bao-tree", "bytes", "chrono", + "data-encoding", "derive_more", "futures-buffered", "futures-lite 2.5.0", @@ -2116,6 +2110,7 @@ dependencies = [ "hex", "iroh", "iroh-base", + "iroh-blake3", "iroh-io", "iroh-metrics", "iroh-quinn", @@ -2129,17 +2124,16 @@ dependencies = [ "quic-rpc-derive", "rand", "range-collections", - "redb 1.5.1", - "redb 2.2.0", - "ref-cast", + "redb 2.3.0", "reflink-copy", "self_cell", "serde", "serde-error", "smallvec", + "ssh-key", "strum", "tempfile", - "thiserror 2.0.4", + "thiserror 2.0.7", "tokio", "tokio-util", "tracing", @@ -2186,7 +2180,7 @@ dependencies = [ "rand_chacha", "rand_core", "redb 1.5.1", - "redb 2.2.0", + "redb 2.3.0", "self_cell", "serde", "serde-error", @@ -2196,7 +2190,7 @@ dependencies = [ "test-strategy", "testdir", "testresult", - "thiserror 2.0.4", + "thiserror 2.0.7", "tokio", "tokio-stream", "tokio-util", @@ -2207,7 +2201,7 @@ dependencies = [ [[package]] name = "iroh-gossip" version = "0.29.0" -source = "git+https://github.com/n0-computer/iroh-gossip?branch=main#0e6fd20203c6468af9d783f1e62379eca283188a" +source = "git+https://github.com/n0-computer/iroh-gossip?branch=iroh-v0-30-0#5b31e50dd8f3419a4cde19706f53ff86c6448449" dependencies = [ "anyhow", "async-channel", @@ -2269,7 +2263,7 @@ dependencies = [ [[package]] name = "iroh-net-report" version = "0.29.0" -source = "git+https://github.com/n0-computer/iroh?branch=main#321d8ffd3d2bde2f1a80e78eab1ad83687484fc2" +source = "git+https://github.com/n0-computer/iroh?branch=main#1ba140f143a472821f989aa9d05b057909bbc6fd" dependencies = [ "anyhow", "bytes", @@ -2279,6 +2273,7 @@ dependencies = [ "hickory-resolver", "iroh-base", "iroh-metrics", + "iroh-quinn", "iroh-relay", "netwatch", "portmapper", @@ -2345,19 +2340,19 @@ dependencies = [ [[package]] name = "iroh-relay" version = "0.29.0" -source = "git+https://github.com/n0-computer/iroh?branch=main#321d8ffd3d2bde2f1a80e78eab1ad83687484fc2" +source = "git+https://github.com/n0-computer/iroh?branch=main#1ba140f143a472821f989aa9d05b057909bbc6fd" dependencies = [ "anyhow", "base64", "bytes", "clap", + "data-encoding", "derive_more", "futures-buffered", "futures-lite 2.5.0", "futures-sink", "futures-util", "governor", - "hex", "hickory-proto", "hickory-resolver", "hostname 0.4.0", @@ -2372,22 +2367,24 @@ dependencies = [ "libc", "num_enum", "once_cell", - "parking_lot", "pin-project", "postcard", "rand", "rcgen", "regex", + "reloadable-state", "reqwest", "ring", "rustls", + "rustls-cert-file-reader", + "rustls-cert-reloadable-resolver", "rustls-pemfile", "rustls-webpki", "serde", "smallvec", "socket2", "stun-rs", - "thiserror 2.0.4", + "thiserror 2.0.7", "time", "tokio", "tokio-rustls", @@ -2448,9 +2445,9 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "js-sys" -version = "0.3.74" +version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a865e038f7f6ed956f788f0d7d60c541fff74c7bd74272c5d4cf15c63743e705" +checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7" dependencies = [ "once_cell", "wasm-bindgen", @@ -2467,9 +2464,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.167" +version = "0.2.168" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc" +checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d" [[package]] name = "libm" @@ -2487,12 +2484,6 @@ dependencies = [ "libc", ] -[[package]] -name = "linked-hash-map" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" - [[package]] name = "linux-raw-sys" version = "0.4.14" @@ -2546,15 +2537,6 @@ version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" -[[package]] -name = "lru-cache" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" -dependencies = [ - "linked-hash-map", -] - [[package]] name = "mainline" version = "2.0.1" @@ -2640,6 +2622,26 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "moka" +version = "0.12.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32cf62eb4dd975d2dde76432fb1075c49e3ee2331cf36f1f8fd4b66550d32b6f" +dependencies = [ + "crossbeam-channel", + "crossbeam-epoch", + "crossbeam-utils", + "once_cell", + "parking_lot", + "quanta", + "rustc_version", + "smallvec", + "tagptr", + "thiserror 1.0.69", + "triomphe", + "uuid", +] + [[package]] name = "nanorand" version = "0.7.0" @@ -2761,9 +2763,9 @@ dependencies = [ [[package]] name = "netlink-sys" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "416060d346fbaf1f23f9512963e3e878f1a78e707cb699ba9215761754244307" +checksum = "16c903aa70590cb93691bf97a767c8d1d6122d2cc9070433deb3bbf36ce8bd23" dependencies = [ "bytes", "futures", @@ -2796,7 +2798,7 @@ dependencies = [ "rtnetlink 0.14.1", "serde", "socket2", - "thiserror 2.0.4", + "thiserror 2.0.7", "time", "tokio", "tokio-util", @@ -3128,20 +3130,20 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.7.14" +version = "2.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879952a81a83930934cbf1786752d6dedc3b1f29e8f8fb2ad1d0a36f377cf442" +checksum = "8b7cafe60d6cf8e62e1b9b2ea516a089c008945bb5a275416789e7db0bc199dc" dependencies = [ "memchr", - "thiserror 1.0.69", + "thiserror 2.0.7", "ucd-trie", ] [[package]] name = "pest_derive" -version = "2.7.14" +version = "2.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d214365f632b123a47fd913301e14c946c61d1c183ee245fa76eb752e59a02dd" +checksum = "816518421cfc6887a0d62bf441b6ffb4536fcc926395a69e1a85852d4363f57e" dependencies = [ "pest", "pest_generator", @@ -3149,9 +3151,9 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.14" +version = "2.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb55586734301717aea2ac313f50b2eb8f60d2fc3dc01d190eefa2e625f60c4e" +checksum = "7d1396fd3a870fc7838768d171b4616d5c91f6cc25e377b673d714567d99377b" dependencies = [ "pest", "pest_meta", @@ -3162,9 +3164,9 @@ dependencies = [ [[package]] name = "pest_meta" -version = "2.7.14" +version = "2.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b75da2a70cf4d9cb76833c990ac9cd3923c9a8905a8929789ce347c84564d03d" +checksum = "e1e58089ea25d717bfd31fb534e4f3afcc2cc569c70de3e239778991ea3b7dea" dependencies = [ "once_cell", "pest", @@ -3330,7 +3332,7 @@ dependencies = [ "serde", "smallvec", "socket2", - "thiserror 2.0.4", + "thiserror 2.0.7", "time", "tokio", "tokio-util", @@ -3505,9 +3507,9 @@ dependencies = [ [[package]] name = "proptest" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4c2511913b88df1637da85cc8d96ec8e43a3f8bb8ccb71ee1ac240d6f3df58d" +checksum = "14cae93065090804185d3b75f0bf93b8eeda30c7a9b4a33d3bdb3988d6229e50" dependencies = [ "bit-set", "bit-vec", @@ -3525,9 +3527,9 @@ dependencies = [ [[package]] name = "quanta" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5167a477619228a0b284fac2674e3c388cba90631d7b7de620e6f1fcd08da5" +checksum = "773ce68d0bb9bc7ef20be3536ffe94e223e1f365bd374108b2659fac0c65cfe6" dependencies = [ "crossbeam-utils", "libc", @@ -3540,12 +3542,12 @@ dependencies = [ [[package]] name = "quic-rpc" -version = "0.17.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64ae09230350898e9a243a7a4a5fdde934edfb6b010e6a9cfb4136f79b54dbbb" +checksum = "8649f6353ef952672f35ddaf586c1a57152373f3d5b0767c5140b08f2d7ec6f8" dependencies = [ "anyhow", - "derive_more", + "document-features", "flume", "futures-lite 2.5.0", "futures-sink", @@ -3562,9 +3564,9 @@ dependencies = [ [[package]] name = "quic-rpc-derive" -version = "0.17.0" +version = "0.17.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44bb53e37914f7e7c6670dc2c834b9299110620cded49e783e78e9d8baf80128" +checksum = "5a32e88a525c7616b2bfce4be94a875eeac46bf20faea5e580cb54dc739e64e5" dependencies = [ "proc-macro2", "quic-rpc", @@ -3591,7 +3593,7 @@ dependencies = [ "rustc-hash", "rustls", "socket2", - "thiserror 2.0.4", + "thiserror 2.0.7", "tokio", "tracing", ] @@ -3610,7 +3612,7 @@ dependencies = [ "rustls", "rustls-pki-types", "slab", - "thiserror 2.0.4", + "thiserror 2.0.7", "tinyvec", "tracing", "web-time", @@ -3618,9 +3620,9 @@ dependencies = [ [[package]] name = "quinn-udp" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d5a626c6807713b15cac82a6acaccd6043c9a5408c24baae07611fec3f243da" +checksum = "52cd4b1eff68bf27940dd39811292c49e007f4d0b4c357358dc9b0197be6b527" dependencies = [ "cfg_aliases", "libc", @@ -3733,18 +3735,18 @@ dependencies = [ [[package]] name = "redb" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84b1de48a7cf7ba193e81e078d17ee2b786236eed1d3f7c60f8a09545efc4925" +checksum = "a7c2a94325f9c5826b17c42af11067230f503747f870117a28180e85696e21ba" dependencies = [ "libc", ] [[package]] name = "redox_syscall" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" +checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" dependencies = [ "bitflags 2.6.0", ] @@ -3841,6 +3843,23 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +[[package]] +name = "reloadable-core" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dc20ac1418988b60072d783c9f68e28a173fb63493c127952f6face3b40c6e0" + +[[package]] +name = "reloadable-state" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3853ef78d45b50f8b989896304a85239539d39b7f866a000e8846b9b72d74ce8" +dependencies = [ + "arc-swap", + "reloadable-core", + "tokio", +] + [[package]] name = "reqwest" version = "0.12.9" @@ -3871,7 +3890,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "sync_wrapper 1.0.2", + "sync_wrapper", "tokio", "tokio-rustls", "tower-service", @@ -4007,22 +4026,22 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.41" +version = "0.38.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7f649912bc1495e167a6edee79151c84b1bad49748cb4f1f1167f459f6224f6" +checksum = "f93dc38ecbab2eb790ff964bb77fa94faf256fd3e73285fd7ba0903b76bedb85" dependencies = [ "bitflags 2.6.0", "errno", "libc", "linux-raw-sys", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "rustls" -version = "0.23.19" +version = "0.23.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "934b404430bb06b3fae2cba809eb45a1ab1aecd64491213d7c3301b88393f8d1" +checksum = "5065c3f250cbd332cd894be57c40fa52387247659b14a2d6041d121547903b1b" dependencies = [ "log", "once_cell", @@ -4033,6 +4052,41 @@ dependencies = [ "zeroize", ] +[[package]] +name = "rustls-cert-file-reader" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f351eaf1dd003022222d2b1399caac198fefeab45c46b0f98bb03fc7cda9bb27" +dependencies = [ + "rustls-cert-read", + "rustls-pemfile", + "rustls-pki-types", + "thiserror 2.0.7", + "tokio", +] + +[[package]] +name = "rustls-cert-read" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd46e8c5ae4de3345c4786a83f99ec7aff287209b9e26fa883c473aeb28f19d5" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "rustls-cert-reloadable-resolver" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe1baa8a3a1f05eaa9fc55aed4342867f70e5c170ea3bfed1b38c51a4857c0c8" +dependencies = [ + "futures-util", + "reloadable-state", + "rustls", + "rustls-cert-read", + "thiserror 2.0.7", +] + [[package]] name = "rustls-native-certs" version = "0.7.3" @@ -4057,9 +4111,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.10.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" +checksum = "d2bf47e6ff922db3825eb750c4e2ff784c6ff8fb9e13046ef6a1d1c5401b0b37" dependencies = [ "web-time", ] @@ -4205,24 +4259,24 @@ dependencies = [ [[package]] name = "self_cell" -version = "1.0.4" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d369a96f978623eb3dc28807c4852d6cc617fed53da5d3c400feff1ef34a714a" +checksum = "c2fdfc24bc566f839a2da4c4295b82db7d25a24253867d5c64355abb5799bdbe" [[package]] name = "semver" -version = "1.0.23" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba" dependencies = [ "serde", ] [[package]] name = "serde" -version = "1.0.215" +version = "1.0.216" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" +checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e" dependencies = [ "serde_derive", ] @@ -4257,9 +4311,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.215" +version = "1.0.216" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" +checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e" dependencies = [ "proc-macro2", "quote", @@ -4668,12 +4722,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "sync_wrapper" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" - [[package]] name = "sync_wrapper" version = "1.0.2" @@ -4729,6 +4777,12 @@ dependencies = [ "libc", ] +[[package]] +name = "tagptr" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417" + [[package]] name = "tempfile" version = "3.14.0" @@ -4736,7 +4790,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" dependencies = [ "cfg-if", - "fastrand 2.2.0", + "fastrand 2.3.0", "once_cell", "rustix", "windows-sys 0.59.0", @@ -4785,11 +4839,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.4" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f49a1853cf82743e3b7950f77e0f4d622ca36cf4317cba00c767838bac8d490" +checksum = "93605438cbd668185516ab499d589afb7ee1859ea3d5fc8f6b0755e1c7443767" dependencies = [ - "thiserror-impl 2.0.4", + "thiserror-impl 2.0.7", ] [[package]] @@ -4805,9 +4859,9 @@ dependencies = [ [[package]] name = "thiserror-impl" -version = "2.0.4" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8381894bb3efe0c4acac3ded651301ceee58a15d47c2e34885ed1908ad667061" +checksum = "e1d8749b4531af2117677a5fcd12b1348a3fe2b81e36e61ffeac5c4aa3273e36" dependencies = [ "proc-macro2", "quote", @@ -4911,12 +4965,11 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.26.0" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +checksum = "5f6d0975eaace0cf0fcadee4e4aaa5da15b5c079146f2cffb67c113be122bf37" dependencies = [ "rustls", - "rustls-pki-types", "tokio", ] @@ -4940,7 +4993,7 @@ dependencies = [ "rustls", "serde", "serde_json", - "thiserror 2.0.4", + "thiserror 2.0.7", "time", "tokio", "tokio-rustls", @@ -4950,9 +5003,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.16" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f4e6ce100d0eb49a2734f8c0812bcd324cf357d21810932c5df6b96ef2b86f1" +checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" dependencies = [ "futures-core", "pin-project-lite", @@ -4992,9 +5045,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.12" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" +checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078" dependencies = [ "bytes", "futures-core", @@ -5042,14 +5095,14 @@ dependencies = [ [[package]] name = "tower" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2873938d487c3cfb9aed7546dc9f2711d867c9f90c46b889989a2cb84eba6b4f" +checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" dependencies = [ "futures-core", "futures-util", "pin-project-lite", - "sync_wrapper 0.1.2", + "sync_wrapper", "tokio", "tower-layer", "tower-service", @@ -5141,19 +5194,16 @@ dependencies = [ ] [[package]] -name = "try-lock" -version = "0.2.5" +name = "triomphe" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +checksum = "859eb650cfee7434994602c3a68b25d77ad9e68c8a6cd491616ef86661382eb3" [[package]] -name = "ttl_cache" -version = "0.5.1" +name = "try-lock" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4189890526f0168710b6ee65ceaedf1460c48a14318ceec933cb26baa492096a" -dependencies = [ - "linked-hash-map", -] +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "tungstenite" @@ -5201,12 +5251,6 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" -[[package]] -name = "unicode-bidi" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" - [[package]] name = "unicode-ident" version = "1.0.14" @@ -5222,12 +5266,6 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-width" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" - [[package]] name = "unicode-width" version = "0.2.0" @@ -5278,7 +5316,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" dependencies = [ "form_urlencoded", - "idna 1.0.3", + "idna", "percent-encoding", "serde", ] @@ -5307,6 +5345,15 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" +[[package]] +name = "uuid" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" +dependencies = [ + "getrandom", +] + [[package]] name = "valuable" version = "0.1.0" @@ -5367,9 +5414,9 @@ checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" [[package]] name = "wasm-bindgen" -version = "0.2.97" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d15e63b4482863c109d70a7b8706c1e364eb6ea449b201a76c5b89cedcec2d5c" +checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" dependencies = [ "cfg-if", "once_cell", @@ -5378,13 +5425,12 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.97" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d36ef12e3aaca16ddd3f67922bc63e48e953f126de60bd33ccc0101ef9998cd" +checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" dependencies = [ "bumpalo", "log", - "once_cell", "proc-macro2", "quote", "syn 2.0.90", @@ -5393,9 +5439,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.47" +version = "0.4.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dfaf8f50e5f293737ee323940c7d8b08a66a95a419223d9f41610ca08b0833d" +checksum = "38176d9b44ea84e9184eff0bc34cc167ed044f816accfe5922e54d84cf48eca2" dependencies = [ "cfg-if", "js-sys", @@ -5406,9 +5452,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.97" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "705440e08b42d3e4b36de7d66c944be628d579796b8090bfa3471478a2260051" +checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -5416,9 +5462,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.97" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98c9ae5a76e46f4deecd0f0255cc223cfa18dc9b261213b8aa0c7b36f61b3f1d" +checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" dependencies = [ "proc-macro2", "quote", @@ -5429,27 +5475,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.97" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ee99da9c5ba11bd675621338ef6fa52296b76b83305e9b6e5c77d4c286d6d49" - -[[package]] -name = "watchable" -version = "1.1.2" +version = "0.2.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45b42a2f611916b5965120a9cde2b60f2db4454826dd9ad5e6f47c24a5b3b259" -dependencies = [ - "event-listener 4.0.3", - "futures-util", - "parking_lot", - "thiserror 1.0.69", -] +checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" [[package]] name = "web-sys" -version = "0.3.74" +version = "0.3.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a98bc3c33f0fe7e59ad7cd041b89034fa82a7c2d4365ca538dda6cdaf513863c" +checksum = "04dd7223427d52553d3702c004d3b2fe07c148165faa56313cb00211e31c12bc" dependencies = [ "js-sys", "wasm-bindgen", @@ -5802,7 +5836,7 @@ dependencies = [ "futures", "log", "serde", - "thiserror 2.0.4", + "thiserror 2.0.7", "windows 0.58.0", "windows-core 0.58.0", ] diff --git a/src/actor.rs b/src/actor.rs index 98d0225c..5da84d43 100644 --- a/src/actor.rs +++ b/src/actor.rs @@ -11,7 +11,7 @@ use std::{ use anyhow::{anyhow, Context, Result}; use bytes::Bytes; use futures_util::FutureExt; -use iroh_base::hash::Hash; +use iroh_blobs::Hash; use iroh_metrics::inc; use serde::{Deserialize, Serialize}; use tokio::{sync::oneshot, task::JoinSet}; diff --git a/src/cli.rs b/src/cli.rs index ae8f13b6..b139e5d5 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -18,8 +18,6 @@ use dialoguer::Confirm; use futures_buffered::BufferedStreamExt; use futures_lite::{Stream, StreamExt}; use indicatif::{HumanBytes, HumanDuration, MultiProgress, ProgressBar, ProgressStyle}; -use iroh::{hash::Hash, AddrInfoOptions}; -use iroh_base::base32::fmt_short; use iroh_blobs::{ provider::AddProgress, rpc::client::blobs::{self, WrapOption}, @@ -27,7 +25,7 @@ use iroh_blobs::{ fs::{path_content_info, path_to_key, PathContent}, SetTagOption, }, - Tag, + Hash, Tag, }; use serde::{Deserialize, Serialize}; use tokio::io::AsyncReadExt; @@ -35,7 +33,10 @@ use tracing::warn; use crate::{ engine::Origin, - rpc::client::docs::{self, Doc, Entry, LiveEvent, ShareMode}, + rpc::{ + client::docs::{self, Doc, Entry, LiveEvent, ShareMode}, + AddrInfoOptions, + }, store::{DownloadPolicy, FilterKind, Query, SortDirection}, AuthorId, ContentStatus, DocTicket, NamespaceId, }; @@ -531,6 +532,13 @@ impl From for crate::store::SortBy { } } +fn fmt_short(bytes: &[u8]) -> String { + let len = bytes.len().min(10); + data_encoding::BASE32_NOPAD + .encode(&bytes[..len]) + .to_ascii_lowercase() +} + impl DocCommands { /// Runs the document command given the iroh client and the console environment. pub async fn run( @@ -617,7 +625,7 @@ impl DocCommands { println!("Deleted {removed} entries."); println!( "Inserted an empty entry for author {} with key {prefix}.", - fmt_short(author) + fmt_short(author.as_bytes()) ); } else { println!("Aborted.") @@ -674,7 +682,7 @@ impl DocCommands { Self::Leave { doc } => { let doc = get_doc(docs, env, doc).await?; doc.leave().await?; - println!("Doc {} is now inactive", fmt_short(doc.id())); + println!("Doc {} is now inactive", fmt_short(doc.id().as_bytes())); } Self::Import { doc, @@ -823,14 +831,14 @@ impl DocCommands { Ok(details) => { println!( "synced peer {} ({origin}, received {}, sent {}", - fmt_short(event.peer), + fmt_short(event.peer.as_bytes()), details.entries_received, details.entries_sent ) } Err(err) => println!( "failed to sync with peer {} ({origin}): {err}", - fmt_short(event.peer) + fmt_short(event.peer.as_bytes()) ), } } @@ -852,14 +860,14 @@ impl DocCommands { "Deleting a document will permanently remove the document secret key, all document entries, \n\ and all content blobs which are not referenced from other docs or tags." ); - let prompt = format!("Delete document {}?", fmt_short(doc.id())); + let prompt = format!("Delete document {}?", fmt_short(doc.id().as_bytes())); if Confirm::new() .with_prompt(prompt) .interact() .unwrap_or(false) { docs.drop_doc(doc.id()).await?; - println!("Doc {} has been deleted.", fmt_short(doc.id())); + println!("Doc {} has been deleted.", fmt_short(doc.id().as_bytes())); } else { println!("Aborted.") } @@ -981,7 +989,7 @@ async fn fmt_entry(blobs: &blobs::Client, entry: &Entry, mode: DisplayContentMod let key = std::str::from_utf8(entry.key()) .unwrap_or("") .bold(); - let author = fmt_short(entry.author()); + let author = fmt_short(entry.author().as_bytes()); let (Ok(content) | Err(content)) = fmt_content(blobs, entry, mode).await; let len = human_len(entry); format!("@{author}: {key} = {content} ({len})") @@ -1150,7 +1158,7 @@ impl ImportProgressBar { add.set_position(0); add.enable_steady_tick(Duration::from_millis(500)); - let doc_id = fmt_short(doc_id.to_bytes()); + let doc_id = fmt_short(doc_id.as_bytes()); let import = mp.add(ProgressBar::new(0)); import.set_style(ProgressStyle::default_bar() .template("{msg}\n{spinner:.green} [{bar:40.cyan/blue}] {pos}/{len} ({per_sec}, eta {eta})").unwrap() diff --git a/src/cli/authors.rs b/src/cli/authors.rs index 40e6ec58..6cfe04ec 100644 --- a/src/cli/authors.rs +++ b/src/cli/authors.rs @@ -4,10 +4,9 @@ use anyhow::{bail, Result}; use clap::Parser; use derive_more::FromStr; use futures_lite::StreamExt; -use iroh_base::base32::fmt_short; use super::{AuthorsClient, ConsoleEnv}; -use crate::{Author, AuthorId}; +use crate::{cli::fmt_short, Author, AuthorId}; #[allow(missing_docs)] /// Commands to manage authors. @@ -85,14 +84,14 @@ impl AuthorCommands { println!("{}", author); } None => { - println!("No author found {}", fmt_short(author)); + println!("No author found {}", fmt_short(author.as_bytes())); } }, Self::Import { author } => match Author::from_str(&author) { Ok(author) => { let id = author.id(); authors.import(author).await?; - println!("Imported {}", fmt_short(id)); + println!("Imported {}", fmt_short(id.as_bytes())); } Err(err) => { eprintln!("Invalid author key: {}", err); diff --git a/src/engine.rs b/src/engine.rs index a10abc52..499bcd06 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -11,7 +11,7 @@ use std::{ use anyhow::{bail, Context, Result}; use futures_lite::{Stream, StreamExt}; -use iroh::{key::PublicKey, Endpoint, NodeAddr}; +use iroh::{Endpoint, NodeAddr, PublicKey}; use iroh_blobs::{ downloader::Downloader, net_protocol::ProtectCb, store::EntryStatus, util::local_pool::LocalPoolHandle, Hash, diff --git a/src/engine/gossip.rs b/src/engine/gossip.rs index b922e03a..df2187fc 100644 --- a/src/engine/gossip.rs +++ b/src/engine/gossip.rs @@ -49,9 +49,11 @@ impl GossipState { } } hash_map::Entry::Vacant(entry) => { - let sub = self + let mut sub = self .gossip - .join_with_opts(namespace.into(), JoinOptions::with_bootstrap(bootstrap)); + .subscribe_with_opts(namespace.into(), JoinOptions::with_bootstrap(bootstrap)); + + sub.joined().await?; let (sender, stream) = sub.split(); let abort_handle = self.active_tasks.spawn( receive_loop( diff --git a/src/engine/live.rs b/src/engine/live.rs index 88849950..2a5391cf 100644 --- a/src/engine/live.rs +++ b/src/engine/live.rs @@ -7,7 +7,7 @@ use std::{ use anyhow::{Context, Result}; use futures_lite::FutureExt; -use iroh::{key::PublicKey, Endpoint, NodeAddr, NodeId}; +use iroh::{Endpoint, NodeAddr, NodeId, PublicKey}; use iroh_blobs::{ downloader::{DownloadError, DownloadRequest, Downloader}, get::Stats, @@ -451,7 +451,7 @@ impl LiveActor { let peer_id = peer.node_id; // adding a node address without any addressing info fails with an error, // but we still want to include those peers because node discovery might find addresses for them - if peer.info.is_empty() { + if peer.is_empty() { peer_ids.push(peer_id) } else { match self.endpoint.add_node_addr_with_source(peer, SOURCE_NAME) { diff --git a/src/net.rs b/src/net.rs index 8d15e370..67ebfaf4 100644 --- a/src/net.rs +++ b/src/net.rs @@ -5,7 +5,7 @@ use std::{ time::{Duration, Instant}, }; -use iroh::{endpoint::get_remote_node_id, key::PublicKey, Endpoint, NodeAddr}; +use iroh::{endpoint::get_remote_node_id, Endpoint, NodeAddr, PublicKey}; #[cfg(feature = "metrics")] use iroh_metrics::inc; use serde::{Deserialize, Serialize}; diff --git a/src/net/codec.rs b/src/net/codec.rs index 3377f175..b8f4060c 100644 --- a/src/net/codec.rs +++ b/src/net/codec.rs @@ -3,7 +3,7 @@ use std::future::Future; use anyhow::{anyhow, ensure}; use bytes::{Buf, BufMut, BytesMut}; use futures_util::SinkExt; -use iroh::key::PublicKey; +use iroh::PublicKey; use serde::{Deserialize, Serialize}; use tokio::io::{AsyncRead, AsyncWrite}; use tokio_stream::StreamExt; @@ -294,7 +294,8 @@ impl BobState { #[cfg(test)] mod tests { use anyhow::Result; - use iroh::{hash::Hash, key::SecretKey}; + use iroh::SecretKey; + use iroh_blobs::Hash; use rand_core::{CryptoRngCore, SeedableRng}; use super::*; @@ -489,8 +490,8 @@ mod tests { "bob & alice each using {num_authors} authors and inserting {num_messages} messages per author" ); - let alice_node_pubkey = SecretKey::generate_with_rng(&mut rng).public(); - let bob_node_pubkey = SecretKey::generate_with_rng(&mut rng).public(); + let alice_node_pubkey = SecretKey::generate(&mut rng).public(); + let bob_node_pubkey = SecretKey::generate(&mut rng).public(); let namespace = NamespaceSecret::new(&mut rng); let mut all_messages = vec![]; @@ -629,8 +630,8 @@ mod tests { async fn test_sync_timestamps(mut alice_store: Store, mut bob_store: Store) -> Result<()> { let mut rng = rand_chacha::ChaCha12Rng::seed_from_u64(99); - let alice_node_pubkey = SecretKey::generate_with_rng(&mut rng).public(); - let bob_node_pubkey = SecretKey::generate_with_rng(&mut rng).public(); + let alice_node_pubkey = SecretKey::generate(&mut rng).public(); + let bob_node_pubkey = SecretKey::generate(&mut rng).public(); let namespace = NamespaceSecret::new(&mut rng); let author = alice_store.new_author(&mut rng)?; diff --git a/src/rpc.rs b/src/rpc.rs index f252a84d..99e6804f 100644 --- a/src/rpc.rs +++ b/src/rpc.rs @@ -2,11 +2,13 @@ use std::{ops::Deref, sync::Arc}; +use iroh::NodeAddr; use proto::{Request, RpcService}; use quic_rpc::{ server::{ChannelTypes, RpcChannel}, RpcClient, RpcServer, }; +use serde::{Deserialize, Serialize}; use tokio_util::task::AbortOnDropHandle; use crate::engine::Engine; @@ -101,3 +103,65 @@ impl RpcHandler { Self { client, _handler } } } + +/// Options to configure what is included in a [`NodeAddr`] and [`AddrInfo`]. +#[derive( + Copy, + Clone, + PartialEq, + Eq, + Default, + Debug, + derive_more::Display, + derive_more::FromStr, + Serialize, + Deserialize, +)] +pub enum AddrInfoOptions { + /// Only the Node ID is added. + /// + /// This usually means that iroh-dns discovery is used to find address information. + #[default] + Id, + /// Includes the Node ID and both the relay URL, and the direct addresses. + RelayAndAddresses, + /// Includes the Node ID and the relay URL. + Relay, + /// Includes the Node ID and the direct addresses. + Addresses, +} + +impl AddrInfoOptions { + /// Apply the options to the given address. + pub fn apply( + &self, + NodeAddr { + node_id, + relay_url, + direct_addresses, + }: &NodeAddr, + ) -> NodeAddr { + match self { + Self::Id => NodeAddr { + node_id: *node_id, + relay_url: None, + direct_addresses: Default::default(), + }, + Self::Relay => NodeAddr { + node_id: *node_id, + relay_url: relay_url.clone(), + direct_addresses: Default::default(), + }, + Self::Addresses => NodeAddr { + node_id: *node_id, + relay_url: None, + direct_addresses: direct_addresses.clone(), + }, + Self::RelayAndAddresses => NodeAddr { + node_id: *node_id, + relay_url: relay_url.clone(), + direct_addresses: direct_addresses.clone(), + }, + } + } +} diff --git a/src/rpc/client/docs.rs b/src/rpc/client/docs.rs index 8562fa5a..a0b44ea6 100644 --- a/src/rpc/client/docs.rs +++ b/src/rpc/client/docs.rs @@ -12,7 +12,7 @@ use anyhow::{anyhow, Context as _, Result}; use bytes::Bytes; use derive_more::{Display, FromStr}; use futures_lite::{Stream, StreamExt}; -use iroh::{AddrInfoOptions, NodeAddr}; +use iroh::NodeAddr; use iroh_blobs::{export::ExportProgress, store::ExportMode, Hash}; use portable_atomic::{AtomicBool, Ordering}; use quic_rpc::{ @@ -23,12 +23,15 @@ use serde::{Deserialize, Serialize}; use super::{authors, flatten}; use crate::{ actor::OpenState, - rpc::proto::{ - CloseRequest, CreateRequest, DelRequest, DelResponse, DocListRequest, DocSubscribeRequest, - DropRequest, ExportFileRequest, GetDownloadPolicyRequest, GetExactRequest, GetManyRequest, - GetSyncPeersRequest, ImportFileRequest, ImportRequest, LeaveRequest, OpenRequest, - RpcService, SetDownloadPolicyRequest, SetHashRequest, SetRequest, ShareRequest, - StartSyncRequest, StatusRequest, + rpc::{ + proto::{ + CloseRequest, CreateRequest, DelRequest, DelResponse, DocListRequest, + DocSubscribeRequest, DropRequest, ExportFileRequest, GetDownloadPolicyRequest, + GetExactRequest, GetManyRequest, GetSyncPeersRequest, ImportFileRequest, ImportRequest, + LeaveRequest, OpenRequest, RpcService, SetDownloadPolicyRequest, SetHashRequest, + SetRequest, ShareRequest, StartSyncRequest, StatusRequest, + }, + AddrInfoOptions, }, store::{DownloadPolicy, Query}, AuthorId, Capability, CapabilityKind, DocTicket, NamespaceId, PeerIdBytes, diff --git a/src/rpc/docs_handle_request.rs b/src/rpc/docs_handle_request.rs index 350dc05e..c7a1e731 100644 --- a/src/rpc/docs_handle_request.rs +++ b/src/rpc/docs_handle_request.rs @@ -207,12 +207,12 @@ impl Handler { mode, addr_options, } = req; - let mut me = self + let me = self .endpoint .node_addr() .await .map_err(|e| RpcError::new(&*e))?; - me.apply_options(addr_options); + let me = addr_options.apply(&me); let capability = match mode { ShareMode::Read => crate::Capability::Read(doc_id), diff --git a/src/rpc/proto.rs b/src/rpc/proto.rs index b1f4fcb1..99876fb4 100644 --- a/src/rpc/proto.rs +++ b/src/rpc/proto.rs @@ -3,7 +3,7 @@ use std::path::PathBuf; use bytes::Bytes; -use iroh::{AddrInfoOptions, NodeAddr}; +use iroh::NodeAddr; use iroh_blobs::{export::ExportProgress, store::ExportMode, Hash}; use nested_enum_utils::enum_conversions; use quic_rpc::pattern::try_server_streaming::StreamCreated; @@ -12,7 +12,7 @@ use serde::{Deserialize, Serialize}; use super::{ client::docs::{ImportProgress, ShareMode}, - RpcError, RpcResult, + AddrInfoOptions, RpcError, RpcResult, }; use crate::{ actor::OpenState, diff --git a/src/store/fs.rs b/src/store/fs.rs index 75827bd9..823dc480 100644 --- a/src/store/fs.rs +++ b/src/store/fs.rs @@ -11,7 +11,7 @@ use std::{ use anyhow::{anyhow, Result}; use ed25519_dalek::{SignatureError, VerifyingKey}; -use iroh_base::hash::Hash; +use iroh_blobs::Hash; use rand_core::CryptoRngCore; use redb::{Database, DatabaseError, ReadableMultimapTable, ReadableTable, ReadableTableMetadata}; diff --git a/src/store/fs/query.rs b/src/store/fs/query.rs index 72113f2e..e04f9861 100644 --- a/src/store/fs/query.rs +++ b/src/store/fs/query.rs @@ -1,5 +1,5 @@ use anyhow::Result; -use iroh_base::hash::Hash; +use iroh_blobs::Hash; use super::{ bounds::{ByKeyBounds, RecordsBounds}, diff --git a/src/sync.rs b/src/sync.rs index fdccf054..9f3d5403 100644 --- a/src/sync.rs +++ b/src/sync.rs @@ -16,7 +16,7 @@ use std::{ use bytes::{Bytes, BytesMut}; use ed25519_dalek::{Signature, SignatureError}; -use iroh_base::hash::Hash; +use iroh_blobs::Hash; #[cfg(feature = "metrics")] use iroh_metrics::{inc, inc_by}; use serde::{Deserialize, Serialize}; diff --git a/src/ticket.rs b/src/ticket.rs index 1e668fb7..6e8ebb53 100644 --- a/src/ticket.rs +++ b/src/ticket.rs @@ -1,6 +1,7 @@ //! Tickets for [`iroh-docs`] documents. -use iroh::{ticket, NodeAddr}; +use iroh::NodeAddr; +use iroh_base::ticket; use serde::{Deserialize, Serialize}; use crate::Capability; @@ -64,7 +65,7 @@ impl std::str::FromStr for DocTicket { mod tests { use std::str::FromStr; - use iroh::key::PublicKey; + use iroh::PublicKey; use iroh_test::{assert_eq_hex, hexdump::parse_hexdump}; use super::*; diff --git a/tests/sync.rs b/tests/sync.rs index 3925ffff..ac8feff4 100644 --- a/tests/sync.rs +++ b/tests/sync.rs @@ -10,13 +10,13 @@ use anyhow::{anyhow, bail, Context, Result}; use bytes::Bytes; use futures_lite::Stream; use futures_util::{FutureExt, StreamExt, TryStreamExt}; -use iroh::{ - key::{PublicKey, SecretKey}, - AddrInfoOptions, RelayMode, -}; +use iroh::{PublicKey, RelayMode, SecretKey}; use iroh_blobs::Hash; use iroh_docs::{ - rpc::client::docs::{Doc, Entry, LiveEvent, ShareMode}, + rpc::{ + client::docs::{Doc, Entry, LiveEvent, ShareMode}, + AddrInfoOptions, + }, store::{DownloadPolicy, FilterKind, Query}, AuthorId, ContentStatus, }; @@ -41,7 +41,7 @@ fn spawn_node( i: usize, rng: &mut (impl CryptoRng + Rng), ) -> impl Future>> + 'static { - let secret_key = SecretKey::generate_with_rng(rng); + let secret_key = SecretKey::generate(rng); async move { let node = test_node(secret_key); let node = node.spawn().await?; @@ -515,7 +515,7 @@ async fn test_sync_via_relay() -> Result<()> { .await?; // remove direct addrs to force connect via relay - ticket.nodes[0].info.direct_addresses = Default::default(); + ticket.nodes[0].direct_addresses = Default::default(); // join let doc2 = node2.docs().import(ticket).await?; @@ -591,7 +591,7 @@ async fn sync_restart_node() -> Result<()> { let discovery_server = iroh::test_utils::DnsPkarrServer::run().await?; let node1_dir = tempfile::TempDir::with_prefix("test-sync_restart_node-node1")?; - let secret_key_1 = SecretKey::generate_with_rng(&mut rng); + let secret_key_1 = SecretKey::generate(&mut rng); let node1 = Node::persistent(&node1_dir) .secret_key(secret_key_1.clone()) @@ -612,7 +612,7 @@ async fn sync_restart_node() -> Result<()> { .await?; // create node2 - let secret_key_2 = SecretKey::generate_with_rng(&mut rng); + let secret_key_2 = SecretKey::generate(&mut rng); let node2 = Node::memory() .secret_key(secret_key_2.clone()) .relay_mode(RelayMode::Custom(relay_map.clone())) diff --git a/tests/util.rs b/tests/util.rs index 2e51a50c..f0d75e21 100644 --- a/tests/util.rs +++ b/tests/util.rs @@ -7,7 +7,7 @@ use std::{ path::{Path, PathBuf}, }; -use iroh::{discovery::Discovery, dns::DnsResolver, key::SecretKey, NodeId, RelayMode}; +use iroh::{discovery::Discovery, dns::DnsResolver, NodeId, RelayMode, SecretKey}; use iroh_blobs::{ net_protocol::Blobs, store::{GcConfig, Store as BlobStore}, From e8c349fa9d0f2a70180d9fa94562d68f2857dc4e Mon Sep 17 00:00:00 2001 From: dignifiedquire Date: Mon, 16 Dec 2024 17:34:11 +0100 Subject: [PATCH 02/13] fixup --- Cargo.toml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ade1d94f..6ef5c63d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,7 +35,7 @@ futures-buffered = "0.2.4" futures-lite = "2.3.0" futures-util = { version = "0.3.25" } hex = "0.4" -iroh-base = { version = "0.29" } +iroh-base = { version = "0.29", features = ["ticket"] } iroh-blobs = { version = "0.29.0", optional = true, features = ["downloader"] } iroh-gossip = { version = "0.29.0", optional = true, features = ["net"] } iroh-metrics = { version = "0.29.0", default-features = false } @@ -66,6 +66,7 @@ portable-atomic = { version = "1.9.0", optional = true } # cli clap = { version = "4", features = ["derive"], optional = true } console = { version = "0.15", optional = true } +data-encoding = { version = "2.3.3", optional = true } indicatif = { version = "0.17", features = ["tokio"], optional = true } dialoguer = { version = "0.11", optional = true } colored = { version = "2.1", optional = true } @@ -100,8 +101,8 @@ cli = [ "dep:colored", "dep:dialoguer", "dep:shellexpand", + "dep:data-encoding", "iroh-blobs/rpc", - "iroh-base/base32" ] rpc = [ "engine", @@ -120,5 +121,5 @@ rustdoc-args = ["--cfg", "iroh_docsrs"] [patch.crates-io] iroh-base = { git = "https://github.com/n0-computer/iroh", branch = "main" } iroh = { git = "https://github.com/n0-computer/iroh", branch = "main" } -iroh-blobs = { git = "https://github.com/n0-computer/iroh-blobs", branch = "main" } -iroh-gossip = { git = "https://github.com/n0-computer/iroh-gossip", branch = "main" } +iroh-blobs = { git = "https://github.com/n0-computer/iroh-blobs", branch = "iroh-v0-30-0" } +iroh-gossip = { git = "https://github.com/n0-computer/iroh-gossip", branch = "iroh-v0-30-0" } From 72042b7a985e842d59ebb87b8ee732b70b0fa63b Mon Sep 17 00:00:00 2001 From: dignifiedquire Date: Mon, 16 Dec 2024 17:38:22 +0100 Subject: [PATCH 03/13] update msrv --- .github/workflows/ci.yaml | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c150fb72..e6526ce1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -16,7 +16,7 @@ env: RUST_BACKTRACE: 1 RUSTFLAGS: -Dwarnings RUSTDOCFLAGS: -Dwarnings - MSRV: "1.76" + MSRV: "1.81" SCCACHE_CACHE_SIZE: "50G" IROH_FORCE_STAGING_RELAYS: "1" @@ -205,7 +205,7 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2024-05-02 + toolchain: nightly-2024-11-30 - name: Install sccache uses: mozilla-actions/sccache-action@v0.0.6 diff --git a/Cargo.toml b/Cargo.toml index 6ef5c63d..05dcbcd4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ authors = ["n0 team"] repository = "https://github.com/n0-computer/iroh-docs" # Sadly this also needs to be updated in .github/workflows/ci.yml -rust-version = "1.76" +rust-version = "1.81" [lints.rust] missing_debug_implementations = "warn" From 9f56de93af245308de09f076ddff98929803a196 Mon Sep 17 00:00:00 2001 From: dignifiedquire Date: Mon, 16 Dec 2024 18:59:15 +0100 Subject: [PATCH 04/13] ci fixup --- .github/workflows/docs.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 6000704b..6bbaac47 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -32,7 +32,7 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2024-05-02 + toolchain: nightly-2024-11-30 - name: Install sccache uses: mozilla-actions/sccache-action@v0.0.6 @@ -68,6 +68,6 @@ jobs: comment-id: ${{ steps.fc.outputs.comment-id }} body: | Documentation for this PR has been generated and is available at: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/${{ env.PREVIEW_PATH }}/iroh_docs/ - + Last updated: ${{ env.TIMESTAMP }} edit-mode: replace From 3c64d7d9887ac4cd7a293d20748508167f28a726 Mon Sep 17 00:00:00 2001 From: dignifiedquire Date: Mon, 16 Dec 2024 19:25:03 +0100 Subject: [PATCH 05/13] fixup gossip sub --- src/engine/gossip.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/engine/gossip.rs b/src/engine/gossip.rs index df2187fc..72f70dbf 100644 --- a/src/engine/gossip.rs +++ b/src/engine/gossip.rs @@ -49,11 +49,10 @@ impl GossipState { } } hash_map::Entry::Vacant(entry) => { - let mut sub = self + let sub = self .gossip .subscribe_with_opts(namespace.into(), JoinOptions::with_bootstrap(bootstrap)); - sub.joined().await?; let (sender, stream) = sub.split(); let abort_handle = self.active_tasks.spawn( receive_loop( From 087e801f090b84a5725caf146d7cb5909623daa9 Mon Sep 17 00:00:00 2001 From: dignifiedquire Date: Mon, 16 Dec 2024 21:22:51 +0100 Subject: [PATCH 06/13] update iroh-metrics --- Cargo.lock | 49 ++++++++++++++++++++++++++++++++++--------------- Cargo.toml | 2 +- 2 files changed, 35 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b4c0b66e..095a6b19 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -49,6 +49,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + [[package]] name = "android-tzdata" version = "0.1.1" @@ -840,7 +846,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", - "serde", ] [[package]] @@ -1181,6 +1186,12 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foldhash" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81ec6369c545a7d40e4589b5597581fa1c441fe1cce96dd1de43159910a36a2" + [[package]] name = "form_urlencoded" version = "1.2.1" @@ -1485,6 +1496,11 @@ name = "hashbrown" version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash", +] [[package]] name = "hashlink" @@ -1671,9 +1687,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "1.5.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97818827ef4f364230e16705d4706e2897df2bb60617d6ca15d598025a3c481f" +checksum = "256fb8d4bd6413123cc9d91832d78325c48ff41677595be797d90f42969beae0" dependencies = [ "bytes", "futures-channel", @@ -1982,7 +1998,7 @@ checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" [[package]] name = "iroh" version = "0.29.0" -source = "git+https://github.com/n0-computer/iroh?branch=main#1ba140f143a472821f989aa9d05b057909bbc6fd" +source = "git+https://github.com/n0-computer/iroh?branch=main#dcd0b401b1738a4ea6be66cdbfe48a0a7ed1aadc" dependencies = [ "aead", "anyhow", @@ -2063,7 +2079,7 @@ dependencies = [ [[package]] name = "iroh-base" version = "0.29.0" -source = "git+https://github.com/n0-computer/iroh?branch=main#1ba140f143a472821f989aa9d05b057909bbc6fd" +source = "git+https://github.com/n0-computer/iroh?branch=main#dcd0b401b1738a4ea6be66cdbfe48a0a7ed1aadc" dependencies = [ "curve25519-dalek", "data-encoding", @@ -2093,7 +2109,7 @@ dependencies = [ [[package]] name = "iroh-blobs" version = "0.29.0" -source = "git+https://github.com/n0-computer/iroh-blobs?branch=iroh-v0-30-0#3d558aa8e8789737a2da34b24e75c14fcc192b2d" +source = "git+https://github.com/n0-computer/iroh-blobs?branch=iroh-v0-30-0#be3cee555f89e9ab20c38d55b5ef677ac04d8aca" dependencies = [ "anyhow", "async-channel", @@ -2201,7 +2217,7 @@ dependencies = [ [[package]] name = "iroh-gossip" version = "0.29.0" -source = "git+https://github.com/n0-computer/iroh-gossip?branch=iroh-v0-30-0#5b31e50dd8f3419a4cde19706f53ff86c6448449" +source = "git+https://github.com/n0-computer/iroh-gossip?branch=iroh-v0-30-0#5555db561a89bf1ae6220442f42938e5c38a6de8" dependencies = [ "anyhow", "async-channel", @@ -2241,11 +2257,10 @@ dependencies = [ [[package]] name = "iroh-metrics" -version = "0.29.0" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a242381d5da20bb4a6cc7482b5cc687a739da8371aff0ea8c12aaf499801886b" +checksum = "d7efd9d7437db258f4d44852beea820cd872e4db976928ee0c2bc615b8c4fe5a" dependencies = [ - "anyhow", "erased_set", "http-body-util", "hyper", @@ -2255,7 +2270,7 @@ dependencies = [ "reqwest", "serde", "struct_iterable", - "time", + "thiserror 2.0.7", "tokio", "tracing", ] @@ -2263,7 +2278,7 @@ dependencies = [ [[package]] name = "iroh-net-report" version = "0.29.0" -source = "git+https://github.com/n0-computer/iroh?branch=main#1ba140f143a472821f989aa9d05b057909bbc6fd" +source = "git+https://github.com/n0-computer/iroh?branch=main#dcd0b401b1738a4ea6be66cdbfe48a0a7ed1aadc" dependencies = [ "anyhow", "bytes", @@ -2340,7 +2355,7 @@ dependencies = [ [[package]] name = "iroh-relay" version = "0.29.0" -source = "git+https://github.com/n0-computer/iroh?branch=main#1ba140f143a472821f989aa9d05b057909bbc6fd" +source = "git+https://github.com/n0-computer/iroh?branch=main#dcd0b401b1738a4ea6be66cdbfe48a0a7ed1aadc" dependencies = [ "anyhow", "base64", @@ -2365,6 +2380,7 @@ dependencies = [ "iroh-quinn", "iroh-quinn-proto", "libc", + "lru", "num_enum", "once_cell", "pin-project", @@ -2536,6 +2552,9 @@ name = "lru" version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" +dependencies = [ + "hashbrown 0.15.2", +] [[package]] name = "mainline" @@ -3313,9 +3332,9 @@ checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6" [[package]] name = "portmapper" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68ea24e7552a28ee4a3478ae116c89080957d6816526d0a533bee6cd67048279" +checksum = "9e6b2058e5b2c829b7dcc62bb94ec223e2fdf07cad157b09ab05c5520af6f5b6" dependencies = [ "anyhow", "base64", diff --git a/Cargo.toml b/Cargo.toml index 05dcbcd4..596478ce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,7 +38,7 @@ hex = "0.4" iroh-base = { version = "0.29", features = ["ticket"] } iroh-blobs = { version = "0.29.0", optional = true, features = ["downloader"] } iroh-gossip = { version = "0.29.0", optional = true, features = ["net"] } -iroh-metrics = { version = "0.29.0", default-features = false } +iroh-metrics = { version = "0.30.0", default-features = false } iroh = { version = "0.29", optional = true } num_enum = "0.7" postcard = { version = "1", default-features = false, features = ["alloc", "use-std", "experimental-derive"] } From 53f8763958fed679c57a2ca82ae3f14c6a2a6a5c Mon Sep 17 00:00:00 2001 From: dignifiedquire Date: Mon, 16 Dec 2024 22:08:07 +0100 Subject: [PATCH 07/13] update to released --- Cargo.lock | 28 ++++++++++++++++------------ Cargo.toml | 12 +++++------- deny.toml | 2 -- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 095a6b19..e8035e4b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1997,8 +1997,9 @@ checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" [[package]] name = "iroh" -version = "0.29.0" -source = "git+https://github.com/n0-computer/iroh?branch=main#dcd0b401b1738a4ea6be66cdbfe48a0a7ed1aadc" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a59352a43dc4199fc804e1a7f3729bd14baff496fd3efbba98763e204bc4af0" dependencies = [ "aead", "anyhow", @@ -2078,8 +2079,9 @@ dependencies = [ [[package]] name = "iroh-base" -version = "0.29.0" -source = "git+https://github.com/n0-computer/iroh?branch=main#dcd0b401b1738a4ea6be66cdbfe48a0a7ed1aadc" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdd4101e3f0732d901beb5461cb9bc415feeda8d21281ab5bf5c0c3458eebde2" dependencies = [ "curve25519-dalek", "data-encoding", @@ -2109,7 +2111,7 @@ dependencies = [ [[package]] name = "iroh-blobs" version = "0.29.0" -source = "git+https://github.com/n0-computer/iroh-blobs?branch=iroh-v0-30-0#be3cee555f89e9ab20c38d55b5ef677ac04d8aca" +source = "git+https://github.com/n0-computer/iroh-blobs?branch=iroh-v0-30-0#d8355aebf74b6fd71e11e2a75f5cd04a755402fe" dependencies = [ "anyhow", "async-channel", @@ -2217,7 +2219,7 @@ dependencies = [ [[package]] name = "iroh-gossip" version = "0.29.0" -source = "git+https://github.com/n0-computer/iroh-gossip?branch=iroh-v0-30-0#5555db561a89bf1ae6220442f42938e5c38a6de8" +source = "git+https://github.com/n0-computer/iroh-gossip?branch=iroh-v0-30-0#bde5a28f00e8f104dbeba85e1e227da22412103f" dependencies = [ "anyhow", "async-channel", @@ -2277,8 +2279,9 @@ dependencies = [ [[package]] name = "iroh-net-report" -version = "0.29.0" -source = "git+https://github.com/n0-computer/iroh?branch=main#dcd0b401b1738a4ea6be66cdbfe48a0a7ed1aadc" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ee04b3b957169e3833f08791802e6bd9878213655d1adbcd9191ea78b8d671a" dependencies = [ "anyhow", "bytes", @@ -2354,8 +2357,9 @@ dependencies = [ [[package]] name = "iroh-relay" -version = "0.29.0" -source = "git+https://github.com/n0-computer/iroh?branch=main#dcd0b401b1738a4ea6be66cdbfe48a0a7ed1aadc" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa0080c8d0720009dc5fa109ef2ead96c5aeb8bb8e4534de8f13865520818207" dependencies = [ "anyhow", "base64", @@ -2417,9 +2421,9 @@ dependencies = [ [[package]] name = "iroh-test" -version = "0.29.0" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87d03fbecae1752f869cfe768306d1ab25921df976818e87c7ad624743b4fa8f" +checksum = "858814e2810a29cca50e5489f67dd417f38124315d466bf5420b1bedc6923703" dependencies = [ "anyhow", "tokio", diff --git a/Cargo.toml b/Cargo.toml index 596478ce..6d7fe119 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,11 +35,11 @@ futures-buffered = "0.2.4" futures-lite = "2.3.0" futures-util = { version = "0.3.25" } hex = "0.4" -iroh-base = { version = "0.29", features = ["ticket"] } -iroh-blobs = { version = "0.29.0", optional = true, features = ["downloader"] } -iroh-gossip = { version = "0.29.0", optional = true, features = ["net"] } +iroh-base = { version = "0.30", features = ["ticket"] } +iroh-blobs = { version = "0.29", optional = true, features = ["downloader"] } +iroh-gossip = { version = "0.29", optional = true, features = ["net"] } iroh-metrics = { version = "0.30.0", default-features = false } -iroh = { version = "0.29", optional = true } +iroh = { version = "0.30", optional = true } num_enum = "0.7" postcard = { version = "1", default-features = false, features = ["alloc", "use-std", "experimental-derive"] } rand = "0.8.5" @@ -73,7 +73,7 @@ colored = { version = "2.1", optional = true } shellexpand = { version = "3.1", optional = true } [dev-dependencies] -iroh-test = "0.29" +iroh-test = "0.30" rand_chacha = "0.3.1" tokio = { version = "1", features = ["sync", "macros"] } proptest = "1.2.0" @@ -119,7 +119,5 @@ all-features = true rustdoc-args = ["--cfg", "iroh_docsrs"] [patch.crates-io] -iroh-base = { git = "https://github.com/n0-computer/iroh", branch = "main" } -iroh = { git = "https://github.com/n0-computer/iroh", branch = "main" } iroh-blobs = { git = "https://github.com/n0-computer/iroh-blobs", branch = "iroh-v0-30-0" } iroh-gossip = { git = "https://github.com/n0-computer/iroh-gossip", branch = "iroh-v0-30-0" } diff --git a/deny.toml b/deny.toml index 472c0f24..acc7edf4 100644 --- a/deny.toml +++ b/deny.toml @@ -34,12 +34,10 @@ license-files = [ ignore = [ "RUSTSEC-2024-0370", # unmaintained, no upgrade available "RUSTSEC-2024-0384", # unmaintained, no upgrade available - "RUSTSEC-2024-0421", # todo: remove when iroh gets updated ] [sources] allow-git = [ - "https://github.com/n0-computer/iroh.git", "https://github.com/n0-computer/iroh-blobs.git", "https://github.com/n0-computer/iroh-gossip.git", ] From 7c5c499cd7e04c8dab77bb555fd974549b5c72a8 Mon Sep 17 00:00:00 2001 From: dignifiedquire Date: Mon, 16 Dec 2024 22:11:39 +0100 Subject: [PATCH 08/13] happy docs --- src/lib.rs | 2 +- src/rpc.rs | 2 +- src/sync.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 653715d4..966ff3b9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,7 +3,7 @@ //! //! The crate operates on [Replicas](Replica). A replica contains an unlimited number of //! [Entries][Entry]. Each entry is identified by a key, its author, and the replica's -//! namespace. Its value is the [32-byte BLAKE3 hash](iroh_base::hash::Hash) +//! namespace. Its value is the [32-byte BLAKE3 hash](iroh_blobs::Hash) //! of the entry's content data, the size of this content data, and a timestamp. //! The content data itself is not stored or transferred through a replica. //! diff --git a/src/rpc.rs b/src/rpc.rs index 99e6804f..1aaff7fa 100644 --- a/src/rpc.rs +++ b/src/rpc.rs @@ -104,7 +104,7 @@ impl RpcHandler { } } -/// Options to configure what is included in a [`NodeAddr`] and [`AddrInfo`]. +/// Options to configure what is included in a [`NodeAddr`]. #[derive( Copy, Clone, diff --git a/src/sync.rs b/src/sync.rs index 9f3d5403..e79f975c 100644 --- a/src/sync.rs +++ b/src/sync.rs @@ -888,7 +888,7 @@ impl EntrySignature { /// A single entry in a [`Replica`] /// /// An entry is identified by a key, its [`Author`], and the [`Replica`]'s -/// [`NamespaceSecret`]. Its value is the [32-byte BLAKE3 hash](iroh_base::hash::Hash) +/// [`NamespaceSecret`]. Its value is the [32-byte BLAKE3 hash](iroh_blobs::Hash) /// of the entry's content data, the size of this content data, and a timestamp. #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] pub struct Entry { From f79471abbb397dac27f0937a092d9aa3aab90403 Mon Sep 17 00:00:00 2001 From: dignifiedquire Date: Mon, 16 Dec 2024 23:39:28 +0100 Subject: [PATCH 09/13] adjust deps --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6d7fe119..8149fc6a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,7 +36,7 @@ futures-lite = "2.3.0" futures-util = { version = "0.3.25" } hex = "0.4" iroh-base = { version = "0.30", features = ["ticket"] } -iroh-blobs = { version = "0.29", optional = true, features = ["downloader"] } +iroh-blobs = { version = "0.29" } iroh-gossip = { version = "0.29", optional = true, features = ["net"] } iroh-metrics = { version = "0.30.0", default-features = false } iroh = { version = "0.30", optional = true } @@ -91,7 +91,7 @@ data-encoding = "2.6.0" default = ["net", "metrics", "engine", "test-utils"] net = ["dep:iroh", "tokio/io-util", "dep:tokio-stream", "dep:tokio-util"] metrics = ["iroh-metrics/metrics", "iroh/metrics"] -engine = ["net", "dep:iroh-gossip", "dep:iroh-blobs"] +engine = ["net", "dep:iroh-gossip", "iroh-blobs/downloader"] test-utils = ["iroh/test-utils"] cli = [ "rpc", From 0a828457319e8b7cf714e96f1fc265e0bb53497a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cramfox=E2=80=9D?= <“kasey@n0.computer”> Date: Tue, 17 Dec 2024 03:16:58 -0500 Subject: [PATCH 10/13] test: fix hanging test by calling `store.flush()` --- src/store/fs.rs | 4 ++-- src/sync.rs | 32 ++++++++++++++++++++++---------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/src/store/fs.rs b/src/store/fs.rs index 823dc480..b631bbe3 100644 --- a/src/store/fs.rs +++ b/src/store/fs.rs @@ -1121,7 +1121,7 @@ mod tests { .collect::>>()?; assert_eq!(expected, actual); - + store.flush()?; Ok(()) } @@ -1138,7 +1138,7 @@ mod tests { } // TODO: write test checking that the indexing is done correctly - + store.flush()?; Ok(()) } } diff --git a/src/sync.rs b/src/sync.rs index e79f975c..07ddd037 100644 --- a/src/sync.rs +++ b/src/sync.rs @@ -1358,7 +1358,9 @@ mod tests { assert_eq!(entries_second.len(), 12); assert_eq!(entries, entries_second.into_iter().collect::>()); - test_lru_cache_like_behaviour(&mut store, myspace.id()) + test_lru_cache_like_behaviour(&mut store, myspace.id())?; + store.flush()?; + Ok(()) } /// Test that [`Store::register_useful_peer`] behaves like a LRUCache of size @@ -1585,7 +1587,7 @@ mod tests { .get_exact(namespace.id(), author.id(), key, false)? .unwrap(); assert_eq!(res, entry); - + store.flush()?; Ok(()) } @@ -1637,7 +1639,8 @@ mod tests { check_entries(&mut alice_store, &myspace.id(), &author, &bob_set)?; check_entries(&mut bob_store, &myspace.id(), &author, &alice_set)?; check_entries(&mut bob_store, &myspace.id(), &author, &bob_set)?; - + alice_store.flush()?; + bob_store.flush()?; Ok(()) } @@ -1700,7 +1703,8 @@ mod tests { get_content_hash(&mut alice_store, namespace.id(), author.id(), key)?, Some(alice_hash_2) ); - + alice_store.flush()?; + bob_store.flush()?; Ok(()) } @@ -1758,7 +1762,7 @@ mod tests { get_entry(&mut store, namespace.id(), author.id(), key)?, entry2 ); - + store.flush()?; Ok(()) } @@ -1772,6 +1776,7 @@ mod tests { let hash = Hash::new(b""); let res = replica.insert(b"foo", &alice, hash, 0); assert!(matches!(res, Err(InsertError::EntryIsEmpty))); + store.flush()?; Ok(()) } @@ -1824,7 +1829,7 @@ mod tests { store.get_exact(myspace.id(), alice.id(), b"foo", false)?, None ); - + store.flush()?; Ok(()) } @@ -1876,7 +1881,8 @@ mod tests { sync(&mut alice, &mut bob)?; check_entries(&mut alice_store, &myspace.id(), &author, &["fog", "fooz"])?; check_entries(&mut bob_store, &myspace.id(), &author, &["fog", "fooz"])?; - + alice_store.flush()?; + bob_store.flush()?; Ok(()) } @@ -1928,6 +1934,7 @@ mod tests { .get_many(namespace.id(), Query::all())? .collect::>(); assert_eq!(res.len(), 1); + store.flush()?; Ok(()) } @@ -1994,6 +2001,7 @@ mod tests { namespace.id(), vec![vec![1u8, 0u8], vec![1u8, 2u8]], ); + store.flush()?; Ok(()) } @@ -2033,7 +2041,7 @@ mod tests { let mut latest_keys: Vec> = latest.iter().map(|r| r.2.to_vec()).collect(); latest_keys.sort(); assert_eq!(latest_keys, vec![b"a0.2".to_vec(), b"a1.1".to_vec()]); - + store.flush()?; Ok(()) } @@ -2083,6 +2091,7 @@ mod tests { namespace.id(), vec![vec![1u8, 0u8], vec![1u8, 2u8], vec![0u8, 255u8]], ); + store.flush()?; Ok(()) } @@ -2130,6 +2139,7 @@ mod tests { let mut replica = store.open_replica(&namespace.id())?; let res = replica.hash_and_insert(b"foo", &author, b"bar"); assert!(res.is_ok()); + store.flush()?; Ok(()) } @@ -2246,7 +2256,8 @@ mod tests { assert_eq!(state1.num_recv, 0); assert_eq!(state2.num_sent, 0); assert_eq!(state2.num_recv, 1); - + store1.flush()?; + store2.flush()?; Ok(()) } @@ -2436,7 +2447,7 @@ mod tests { ("hi", &a3), ], ); - + store.flush()?; Ok(()) } @@ -2470,6 +2481,7 @@ mod tests { store.set_download_policy(&id, policy.clone())?; let retrieved_policy = store.get_download_policy(&id)?; assert_eq!(retrieved_policy, policy); + store.flush()?; Ok(()) } From 6adbf4913b49883839e10a8efadbeefc4aed3a84 Mon Sep 17 00:00:00 2001 From: dignifiedquire Date: Tue, 17 Dec 2024 10:33:26 +0100 Subject: [PATCH 11/13] released gossip --- Cargo.lock | 5 +++-- Cargo.toml | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e8035e4b..0267d51e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2218,8 +2218,9 @@ dependencies = [ [[package]] name = "iroh-gossip" -version = "0.29.0" -source = "git+https://github.com/n0-computer/iroh-gossip?branch=iroh-v0-30-0#bde5a28f00e8f104dbeba85e1e227da22412103f" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5c9713c6ba4834857dee19d5e210e86c29476de2ae627963afcd2e6935e628f" dependencies = [ "anyhow", "async-channel", diff --git a/Cargo.toml b/Cargo.toml index 8149fc6a..33e06c3c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,7 +37,7 @@ futures-util = { version = "0.3.25" } hex = "0.4" iroh-base = { version = "0.30", features = ["ticket"] } iroh-blobs = { version = "0.29" } -iroh-gossip = { version = "0.29", optional = true, features = ["net"] } +iroh-gossip = { version = "0.30", optional = true, features = ["net"] } iroh-metrics = { version = "0.30.0", default-features = false } iroh = { version = "0.30", optional = true } num_enum = "0.7" @@ -120,4 +120,3 @@ rustdoc-args = ["--cfg", "iroh_docsrs"] [patch.crates-io] iroh-blobs = { git = "https://github.com/n0-computer/iroh-blobs", branch = "iroh-v0-30-0" } -iroh-gossip = { git = "https://github.com/n0-computer/iroh-gossip", branch = "iroh-v0-30-0" } From 43e1435290ca5c2204c25646b0504f1be62c0a6b Mon Sep 17 00:00:00 2001 From: dignifiedquire Date: Tue, 17 Dec 2024 11:19:43 +0100 Subject: [PATCH 12/13] fs-store: ensure flush on drop --- deny.toml | 1 - src/store/fs.rs | 11 +++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/deny.toml b/deny.toml index acc7edf4..af915491 100644 --- a/deny.toml +++ b/deny.toml @@ -39,5 +39,4 @@ ignore = [ [sources] allow-git = [ "https://github.com/n0-computer/iroh-blobs.git", - "https://github.com/n0-computer/iroh-gossip.git", ] diff --git a/src/store/fs.rs b/src/store/fs.rs index b631bbe3..5ec6e070 100644 --- a/src/store/fs.rs +++ b/src/store/fs.rs @@ -14,6 +14,7 @@ use ed25519_dalek::{SignatureError, VerifyingKey}; use iroh_blobs::Hash; use rand_core::CryptoRngCore; use redb::{Database, DatabaseError, ReadableMultimapTable, ReadableTable, ReadableTableMetadata}; +use tracing::warn; use super::{ pubkeys::MemPublicKeyStore, DownloadPolicy, ImportNamespaceOutcome, OpenError, PublicKeyStore, @@ -55,6 +56,14 @@ pub struct Store { pubkeys: MemPublicKeyStore, } +impl Drop for Store { + fn drop(&mut self) { + if let Err(err) = self.flush() { + warn!("failed to trigger final flush: {:?}", err); + } + } +} + impl AsRef for Store { fn as_ref(&self) -> &Store { self @@ -1121,7 +1130,6 @@ mod tests { .collect::>>()?; assert_eq!(expected, actual); - store.flush()?; Ok(()) } @@ -1138,7 +1146,6 @@ mod tests { } // TODO: write test checking that the indexing is done correctly - store.flush()?; Ok(()) } } From 3f6b924eee51429202416dcb4699cca71236b1ee Mon Sep 17 00:00:00 2001 From: dignifiedquire Date: Tue, 17 Dec 2024 11:22:56 +0100 Subject: [PATCH 13/13] released blobs --- Cargo.lock | 5 +++-- Cargo.toml | 5 +---- deny.toml | 4 +--- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0267d51e..c998c904 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2110,8 +2110,9 @@ dependencies = [ [[package]] name = "iroh-blobs" -version = "0.29.0" -source = "git+https://github.com/n0-computer/iroh-blobs?branch=iroh-v0-30-0#d8355aebf74b6fd71e11e2a75f5cd04a755402fe" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f7859ab0aa3bdae9dc7af965853e786d60381434cac6dcab504a18faa90f26" dependencies = [ "anyhow", "async-channel", diff --git a/Cargo.toml b/Cargo.toml index 33e06c3c..911f498b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,7 +36,7 @@ futures-lite = "2.3.0" futures-util = { version = "0.3.25" } hex = "0.4" iroh-base = { version = "0.30", features = ["ticket"] } -iroh-blobs = { version = "0.29" } +iroh-blobs = { version = "0.30" } iroh-gossip = { version = "0.30", optional = true, features = ["net"] } iroh-metrics = { version = "0.30.0", default-features = false } iroh = { version = "0.30", optional = true } @@ -117,6 +117,3 @@ rpc = [ [package.metadata.docs.rs] all-features = true rustdoc-args = ["--cfg", "iroh_docsrs"] - -[patch.crates-io] -iroh-blobs = { git = "https://github.com/n0-computer/iroh-blobs", branch = "iroh-v0-30-0" } diff --git a/deny.toml b/deny.toml index af915491..28b26fe7 100644 --- a/deny.toml +++ b/deny.toml @@ -37,6 +37,4 @@ ignore = [ ] [sources] -allow-git = [ - "https://github.com/n0-computer/iroh-blobs.git", -] +allow-git = []