From d7f32147b3c818c8d6be46abc04887bc1cd71e40 Mon Sep 17 00:00:00 2001 From: dignifiedquire Date: Mon, 6 May 2024 18:17:28 +0200 Subject: [PATCH] fixup: missing renames --- iroh-cli/src/commands/author.rs | 2 +- iroh-cli/src/commands/blob.rs | 2 +- iroh-cli/src/commands/doc.rs | 12 ++++++------ iroh-cli/src/commands/doctor.rs | 8 ++++---- iroh-cli/src/commands/start.rs | 4 ++-- iroh-cli/src/commands/tag.rs | 2 +- iroh-cli/src/config.rs | 2 +- iroh-cli/tests/cli.rs | 8 ++++---- iroh/examples/client.rs | 2 +- iroh/examples/collection-fetch.rs | 2 +- iroh/examples/collection-provide.rs | 2 +- iroh/examples/hello-world-fetch.rs | 2 +- iroh/src/client/docs.rs | 18 +++++++++--------- iroh/src/{sync_engine.rs => docs_engine.rs} | 4 ++-- .../src/{sync_engine => docs_engine}/gossip.rs | 0 iroh/src/{sync_engine => docs_engine}/live.rs | 0 iroh/src/{sync_engine => docs_engine}/rpc.rs | 4 ++-- iroh/src/{sync_engine => docs_engine}/state.rs | 0 iroh/src/lib.rs | 6 +++--- iroh/src/node.rs | 4 ++-- iroh/src/node/builder.rs | 12 ++++++------ iroh/src/rpc_protocol.rs | 2 +- iroh/tests/provide.rs | 2 +- 23 files changed, 50 insertions(+), 50 deletions(-) rename iroh/src/{sync_engine.rs => docs_engine.rs} (99%) rename iroh/src/{sync_engine => docs_engine}/gossip.rs (100%) rename iroh/src/{sync_engine => docs_engine}/live.rs (100%) rename iroh/src/{sync_engine => docs_engine}/rpc.rs (99%) rename iroh/src/{sync_engine => docs_engine}/state.rs (100%) diff --git a/iroh-cli/src/commands/author.rs b/iroh-cli/src/commands/author.rs index eed5e8bab0..1499a523c7 100644 --- a/iroh-cli/src/commands/author.rs +++ b/iroh-cli/src/commands/author.rs @@ -5,7 +5,7 @@ use futures_lite::StreamExt; use iroh::base::base32::fmt_short; use iroh::client::{Iroh, RpcService}; -use iroh::sync::{Author, AuthorId}; +use iroh::docs::{Author, AuthorId}; use quic_rpc::ServiceConnection; use crate::config::ConsoleEnv; diff --git a/iroh-cli/src/commands/blob.rs b/iroh-cli/src/commands/blob.rs index ed26789877..2a0aeeab6a 100644 --- a/iroh-cli/src/commands/blob.rs +++ b/iroh-cli/src/commands/blob.rs @@ -16,7 +16,7 @@ use indicatif::{ use iroh::{ base::node_addr::AddrInfoOptions, base::ticket::BlobTicket, - bytes::{ + blobs::{ get::{db::DownloadProgress, progress::BlobProgress, Stats}, provider::AddProgress, store::{ diff --git a/iroh-cli/src/commands/doc.rs b/iroh-cli/src/commands/doc.rs index fcdb3af5c0..9b27fc6aca 100644 --- a/iroh-cli/src/commands/doc.rs +++ b/iroh-cli/src/commands/doc.rs @@ -18,13 +18,13 @@ use tokio::io::AsyncReadExt; use iroh::{ base::{base32::fmt_short, node_addr::AddrInfoOptions}, - bytes::{provider::AddProgress, util::SetTagOption, Hash, Tag}, + blobs::{provider::AddProgress, util::SetTagOption, Hash, Tag}, client::{ blobs::WrapOption, docs::{Doc, Entry, LiveEvent, Origin, ShareMode}, Iroh, RpcService, }, - sync::{ + docs::{ store::{DownloadPolicy, FilterKind, Query, SortDirection}, AuthorId, DocTicket, NamespaceId, }, @@ -293,7 +293,7 @@ pub enum Sorting { /// Sort by key, then author Key, } -impl From for iroh::sync::store::SortBy { +impl From for iroh::docs::store::SortBy { fn from(value: Sorting) -> Self { match value { Sorting::Author => Self::AuthorKey, @@ -558,16 +558,16 @@ impl DocCommands { content_status, } => { let content = match content_status { - iroh::sync::ContentStatus::Complete => { + iroh::docs::ContentStatus::Complete => { fmt_entry(&doc, &entry, DisplayContentMode::Auto).await } - iroh::sync::ContentStatus::Incomplete => { + iroh::docs::ContentStatus::Incomplete => { let (Ok(content) | Err(content)) = fmt_content(&doc, &entry, DisplayContentMode::ShortHash) .await; format!("", content, human_len(&entry)) } - iroh::sync::ContentStatus::Missing => { + iroh::docs::ContentStatus::Missing => { let (Ok(content) | Err(content)) = fmt_content(&doc, &entry, DisplayContentMode::ShortHash) .await; diff --git a/iroh-cli/src/commands/doctor.rs b/iroh-cli/src/commands/doctor.rs index 18cee4f426..06ee1ba504 100644 --- a/iroh-cli/src/commands/doctor.rs +++ b/iroh-cli/src/commands/doctor.rs @@ -20,10 +20,11 @@ use futures_lite::StreamExt; use indicatif::{HumanBytes, MultiProgress, ProgressBar}; use iroh::{ base::ticket::{BlobTicket, Ticket}, - bytes::{ + blobs::{ store::{ReadableStore, Store as _}, util::progress::{FlumeProgressSender, ProgressSender}, }, + docs::{Capability, DocTicket}, net::{ defaults::DEFAULT_RELAY_STUN_PORT, discovery::{ @@ -37,7 +38,6 @@ use iroh::{ util::AbortingJoinHandle, MagicEndpoint, NodeAddr, NodeId, }, - sync::{Capability, DocTicket}, util::{path::IrohPaths, progress::ProgressWriter}, }; use portable_atomic::AtomicU64; @@ -1098,7 +1098,7 @@ pub async fn run(command: Commands, config: &NodeConfig) -> anyhow::Result<()> { } Commands::TicketInspect { ticket, zbase32 } => inspect_ticket(&ticket, zbase32), Commands::BlobConsistencyCheck { path, repair } => { - let blob_store = iroh::bytes::store::fs::Store::load(path).await?; + let blob_store = iroh::blobs::store::fs::Store::load(path).await?; let (send, recv) = flume::bounded(1); let task = tokio::spawn(async move { while let Ok(msg) = recv.recv_async().await { @@ -1112,7 +1112,7 @@ pub async fn run(command: Commands, config: &NodeConfig) -> anyhow::Result<()> { Ok(()) } Commands::BlobValidate { path, repair } => { - let blob_store = iroh::bytes::store::fs::Store::load(path).await?; + let blob_store = iroh::blobs::store::fs::Store::load(path).await?; let (send, recv) = flume::bounded(1); let task = tokio::spawn(async move { while let Ok(msg) = recv.recv_async().await { diff --git a/iroh-cli/src/commands/start.rs b/iroh-cli/src/commands/start.rs index 19473ae7b0..ec22c26de8 100644 --- a/iroh-cli/src/commands/start.rs +++ b/iroh-cli/src/commands/start.rs @@ -116,7 +116,7 @@ where pub(crate) async fn start_node( iroh_data_root: &Path, relay_map: Option, -) -> Result> { +) -> Result> { let rpc_status = RpcStatus::load(iroh_data_root).await?; match rpc_status { RpcStatus::Running { port, .. } => { @@ -141,7 +141,7 @@ pub(crate) async fn start_node( .await } -fn welcome_message(node: &Node) -> Result { +fn welcome_message(node: &Node) -> Result { let msg = format!( "{}\nNode ID: {}\n", "Iroh is running".green(), diff --git a/iroh-cli/src/commands/tag.rs b/iroh-cli/src/commands/tag.rs index 0992d9abad..3d995d5a52 100644 --- a/iroh-cli/src/commands/tag.rs +++ b/iroh-cli/src/commands/tag.rs @@ -2,7 +2,7 @@ use anyhow::Result; use bytes::Bytes; use clap::Subcommand; use futures_lite::StreamExt; -use iroh::bytes::Tag; +use iroh::blobs::Tag; use iroh::client::{Iroh, RpcService}; use quic_rpc::ServiceConnection; diff --git a/iroh-cli/src/config.rs b/iroh-cli/src/config.rs index 9a323b6c50..a2bc03fc1d 100644 --- a/iroh-cli/src/config.rs +++ b/iroh-cli/src/config.rs @@ -9,12 +9,12 @@ use std::{ }; use anyhow::{anyhow, bail, Context, Result}; +use iroh::docs::{AuthorId, NamespaceId}; use iroh::net::{ defaults::{default_eu_relay_node, default_na_relay_node}, relay::{RelayMap, RelayNode}, }; use iroh::node::GcPolicy; -use iroh::sync::{AuthorId, NamespaceId}; use parking_lot::RwLock; use serde::{Deserialize, Serialize}; diff --git a/iroh-cli/tests/cli.rs b/iroh-cli/tests/cli.rs index 9c33543d4e..ae6f2993a0 100644 --- a/iroh-cli/tests/cli.rs +++ b/iroh-cli/tests/cli.rs @@ -12,7 +12,7 @@ use bao_tree::blake3; use duct::{cmd, ReaderHandle}; use iroh::{ base::ticket::BlobTicket, - bytes::{Hash, HashAndFormat}, + blobs::{Hash, HashAndFormat}, util::path::IrohPaths, }; use rand::distributions::{Alphanumeric, DistString}; @@ -391,7 +391,7 @@ fn cli_bao_store_migration() -> anyhow::Result<()> { #[tokio::test] #[ignore = "flaky"] async fn cli_provide_persistence() -> anyhow::Result<()> { - use iroh::bytes::store::ReadableStore; + use iroh::blobs::store::ReadableStore; use nix::{ sys::signal::{self, Signal}, unistd::Pid, @@ -447,14 +447,14 @@ async fn cli_provide_persistence() -> anyhow::Result<()> { provide(&foo_path)?; // should have some data now let db_path = IrohPaths::BaoStoreDir.with_root(&iroh_data_dir); - let db = iroh::bytes::store::fs::Store::load(&db_path).await?; + let db = iroh::blobs::store::fs::Store::load(&db_path).await?; let blobs: Vec> = db.blobs().await.unwrap().collect::>(); drop(db); assert_eq!(blobs.len(), 3); provide(&bar_path)?; // should have more data now - let db = iroh::bytes::store::fs::Store::load(&db_path).await?; + let db = iroh::blobs::store::fs::Store::load(&db_path).await?; let blobs = db.blobs().await.unwrap().collect::>(); drop(db); assert_eq!(blobs.len(), 6); diff --git a/iroh/examples/client.rs b/iroh/examples/client.rs index 0d488c42c2..ea8b5bce58 100644 --- a/iroh/examples/client.rs +++ b/iroh/examples/client.rs @@ -6,7 +6,7 @@ //! run this example from the project root: //! $ cargo run --example client use indicatif::HumanBytes; -use iroh::{base::base32, client::docs::Entry, node::Node, sync::store::Query}; +use iroh::{base::base32, client::docs::Entry, docs::store::Query, node::Node}; use tokio_stream::StreamExt; #[tokio::main] diff --git a/iroh/examples/collection-fetch.rs b/iroh/examples/collection-fetch.rs index 88a8598c47..e35f61ba95 100644 --- a/iroh/examples/collection-fetch.rs +++ b/iroh/examples/collection-fetch.rs @@ -6,7 +6,7 @@ use std::{env, str::FromStr}; use anyhow::{bail, ensure, Context, Result}; -use iroh::{base::ticket::BlobTicket, bytes::BlobFormat}; +use iroh::{base::ticket::BlobTicket, blobs::BlobFormat}; use tracing_subscriber::{prelude::*, EnvFilter}; // set the RUST_LOG env var to one of {debug,info,warn} to see logging info diff --git a/iroh/examples/collection-provide.rs b/iroh/examples/collection-provide.rs index 5f12a7b6c9..c6eb7f9fbf 100644 --- a/iroh/examples/collection-provide.rs +++ b/iroh/examples/collection-provide.rs @@ -6,7 +6,7 @@ //! This is using an in memory database and a random node id. //! run this example from the project root: //! $ cargo run --example collection-provide -use iroh::bytes::{format::collection::Collection, util::SetTagOption, BlobFormat}; +use iroh::blobs::{format::collection::Collection, util::SetTagOption, BlobFormat}; use tracing_subscriber::{prelude::*, EnvFilter}; // set the RUST_LOG env var to one of {debug,info,warn} to see logging info diff --git a/iroh/examples/hello-world-fetch.rs b/iroh/examples/hello-world-fetch.rs index 9470d39756..71672845a8 100644 --- a/iroh/examples/hello-world-fetch.rs +++ b/iroh/examples/hello-world-fetch.rs @@ -6,7 +6,7 @@ use std::{env, str::FromStr}; use anyhow::{bail, ensure, Context, Result}; -use iroh::{base::ticket::BlobTicket, bytes::BlobFormat}; +use iroh::{base::ticket::BlobTicket, blobs::BlobFormat}; use tracing_subscriber::{prelude::*, EnvFilter}; // set the RUST_LOG env var to one of {debug,info,warn} to see logging info diff --git a/iroh/src/client/docs.rs b/iroh/src/client/docs.rs index 63d5dfd1d1..15ccfaa2fa 100644 --- a/iroh/src/client/docs.rs +++ b/iroh/src/client/docs.rs @@ -33,7 +33,7 @@ use crate::rpc_protocol::{ }; #[doc(inline)] -pub use crate::sync_engine::{Origin, SyncEvent, SyncReason}; +pub use crate::docs_engine::{Origin, SyncEvent, SyncReason}; use super::{blobs, flatten}; @@ -509,13 +509,13 @@ pub enum LiveEvent { SyncFinished(SyncEvent), } -impl From for LiveEvent { - fn from(event: crate::sync_engine::LiveEvent) -> LiveEvent { +impl From for LiveEvent { + fn from(event: crate::docs_engine::LiveEvent) -> LiveEvent { match event { - crate::sync_engine::LiveEvent::InsertLocal { entry } => Self::InsertLocal { + crate::docs_engine::LiveEvent::InsertLocal { entry } => Self::InsertLocal { entry: entry.into(), }, - crate::sync_engine::LiveEvent::InsertRemote { + crate::docs_engine::LiveEvent::InsertRemote { from, entry, content_status, @@ -524,10 +524,10 @@ impl From for LiveEvent { content_status, entry: entry.into(), }, - crate::sync_engine::LiveEvent::ContentReady { hash } => Self::ContentReady { hash }, - crate::sync_engine::LiveEvent::NeighborUp(node) => Self::NeighborUp(node), - crate::sync_engine::LiveEvent::NeighborDown(node) => Self::NeighborDown(node), - crate::sync_engine::LiveEvent::SyncFinished(details) => Self::SyncFinished(details), + crate::docs_engine::LiveEvent::ContentReady { hash } => Self::ContentReady { hash }, + crate::docs_engine::LiveEvent::NeighborUp(node) => Self::NeighborUp(node), + crate::docs_engine::LiveEvent::NeighborDown(node) => Self::NeighborDown(node), + crate::docs_engine::LiveEvent::SyncFinished(details) => Self::SyncFinished(details), } } } diff --git a/iroh/src/sync_engine.rs b/iroh/src/docs_engine.rs similarity index 99% rename from iroh/src/sync_engine.rs rename to iroh/src/docs_engine.rs index 13e5a222ad..df52d37334 100644 --- a/iroh/src/sync_engine.rs +++ b/iroh/src/docs_engine.rs @@ -38,7 +38,7 @@ const SUBSCRIBE_CHANNEL_CAP: usize = 256; /// The RPC methods dealing with documents and sync operate on the `SyncEngine`, with method /// implementations in [rpc]. #[derive(derive_more::Debug, Clone)] -pub struct SyncEngine { +pub struct Engine { pub(crate) endpoint: MagicEndpoint, pub(crate) sync: SyncHandle, to_live_actor: mpsc::Sender, @@ -48,7 +48,7 @@ pub struct SyncEngine { content_status_cb: ContentStatusCallback, } -impl SyncEngine { +impl Engine { /// Start the sync engine. /// /// This will spawn two tokio tasks for the live sync coordination and gossip actors, and a diff --git a/iroh/src/sync_engine/gossip.rs b/iroh/src/docs_engine/gossip.rs similarity index 100% rename from iroh/src/sync_engine/gossip.rs rename to iroh/src/docs_engine/gossip.rs diff --git a/iroh/src/sync_engine/live.rs b/iroh/src/docs_engine/live.rs similarity index 100% rename from iroh/src/sync_engine/live.rs rename to iroh/src/docs_engine/live.rs diff --git a/iroh/src/sync_engine/rpc.rs b/iroh/src/docs_engine/rpc.rs similarity index 99% rename from iroh/src/sync_engine/rpc.rs rename to iroh/src/docs_engine/rpc.rs index 845c55442c..3cff94d56b 100644 --- a/iroh/src/sync_engine/rpc.rs +++ b/iroh/src/docs_engine/rpc.rs @@ -12,6 +12,7 @@ use crate::rpc_protocol::{ AuthorImportRequest, AuthorImportResponse, DocGetSyncPeersRequest, DocGetSyncPeersResponse, }; use crate::{ + docs_engine::Engine, rpc_protocol::{ AuthorCreateRequest, AuthorCreateResponse, AuthorListRequest, AuthorListResponse, DocCloseRequest, DocCloseResponse, DocCreateRequest, DocCreateResponse, DocDelRequest, @@ -24,14 +25,13 @@ use crate::{ DocStartSyncRequest, DocStartSyncResponse, DocStatusRequest, DocStatusResponse, DocSubscribeRequest, DocSubscribeResponse, RpcResult, }, - sync_engine::SyncEngine, }; /// Capacity for the flume channels to forward sync store iterators to async RPC streams. const ITER_CHANNEL_CAP: usize = 64; #[allow(missing_docs)] -impl SyncEngine { +impl Engine { pub async fn author_create( &self, _req: AuthorCreateRequest, diff --git a/iroh/src/sync_engine/state.rs b/iroh/src/docs_engine/state.rs similarity index 100% rename from iroh/src/sync_engine/state.rs rename to iroh/src/docs_engine/state.rs diff --git a/iroh/src/lib.rs b/iroh/src/lib.rs index f423d3c562..275c23459e 100644 --- a/iroh/src/lib.rs +++ b/iroh/src/lib.rs @@ -12,9 +12,9 @@ #[doc(inline)] pub use iroh_base as base; #[doc(inline)] -pub use iroh_blobs as bytes; +pub use iroh_blobs as blobs; #[doc(inline)] -pub use iroh_docs as sync; +pub use iroh_docs as docs; #[doc(inline)] pub use iroh_net as net; @@ -22,8 +22,8 @@ pub mod client; pub mod node; pub mod util; +mod docs_engine; mod rpc_protocol; -mod sync_engine; /// Expose metrics module #[cfg(feature = "metrics")] diff --git a/iroh/src/node.rs b/iroh/src/node.rs index 5e7d952a4e..36d9dba3f5 100644 --- a/iroh/src/node.rs +++ b/iroh/src/node.rs @@ -32,8 +32,8 @@ use tokio_util::sync::CancellationToken; use tokio_util::task::LocalPoolHandle; use tracing::debug; +use crate::docs_engine::Engine; use crate::rpc_protocol::{Request, Response}; -use crate::sync_engine::SyncEngine; mod builder; mod rpc; @@ -105,7 +105,7 @@ struct NodeInner { gc_task: Option>, #[debug("rt")] rt: LocalPoolHandle, - pub(crate) sync: SyncEngine, + pub(crate) sync: Engine, downloader: Downloader, } diff --git a/iroh/src/node/builder.rs b/iroh/src/node/builder.rs index 2d59a5353b..e423328e4e 100644 --- a/iroh/src/node/builder.rs +++ b/iroh/src/node/builder.rs @@ -14,7 +14,7 @@ use iroh_blobs::{ protocol::Closed, store::{GcMarkEvent, GcSweepEvent, Map, Store as BaoStore}, }; -use iroh_docs::net::SYNC_ALPN; +use iroh_docs::net::DOCS_ALPN; use iroh_gossip::net::{Gossip, GOSSIP_ALPN}; use iroh_net::{ discovery::{dns::DnsDiscovery, pkarr_publish::PkarrPublisher, ConcurrentDiscovery, Discovery}, @@ -34,15 +34,15 @@ use tracing::{debug, error, error_span, info, trace, warn, Instrument}; use crate::{ client::RPC_ALPN, + docs_engine::Engine, node::{Event, NodeInner}, rpc_protocol::{Request, Response, RpcService}, - sync_engine::SyncEngine, util::{fs::load_secret_key, path::IrohPaths}, }; use super::{rpc, rpc_status::RpcStatus, Callbacks, EventCallback, Node}; -pub const PROTOCOLS: [&[u8]; 3] = [iroh_blobs::protocol::ALPN, GOSSIP_ALPN, SYNC_ALPN]; +pub const PROTOCOLS: [&[u8]; 3] = [iroh_blobs::protocol::ALPN, GOSSIP_ALPN, DOCS_ALPN]; /// Default bind address for the node. /// 11204 is "iroh" in leetspeak @@ -419,7 +419,7 @@ where // spawn the sync engine let downloader = Downloader::new(self.blobs_store.clone(), endpoint.clone(), lp.clone()); - let sync = SyncEngine::spawn( + let sync = Engine::spawn( endpoint.clone(), gossip.clone(), self.docs_store, @@ -710,11 +710,11 @@ async fn handle_connection( alpn: String, node: Arc>, gossip: Gossip, - sync: SyncEngine, + sync: Engine, ) -> Result<()> { match alpn.as_bytes() { GOSSIP_ALPN => gossip.handle_connection(connecting.await?).await?, - SYNC_ALPN => sync.handle_connection(connecting).await?, + DOCS_ALPN => sync.handle_connection(connecting).await?, alpn if alpn == iroh_blobs::protocol::ALPN => { iroh_blobs::provider::handle_connection( connecting, diff --git a/iroh/src/rpc_protocol.rs b/iroh/src/rpc_protocol.rs index e035b7d3f0..3fc34f5edd 100644 --- a/iroh/src/rpc_protocol.rs +++ b/iroh/src/rpc_protocol.rs @@ -47,7 +47,7 @@ use crate::{ node::NodeStatus, tags::TagInfo, }, - sync_engine::LiveEvent, + docs_engine::LiveEvent, }; pub use iroh_blobs::util::SetTagOption; diff --git a/iroh/tests/provide.rs b/iroh/tests/provide.rs index dbeebfc789..9f8370b23f 100644 --- a/iroh/tests/provide.rs +++ b/iroh/tests/provide.rs @@ -35,7 +35,7 @@ async fn dial(secret_key: SecretKey, peer: NodeAddr) -> anyhow::Result