Skip to content

Commit

Permalink
fixup: missing renames
Browse files Browse the repository at this point in the history
  • Loading branch information
dignifiedquire committed May 6, 2024
1 parent bc1d31e commit d7f3214
Show file tree
Hide file tree
Showing 23 changed files with 50 additions and 50 deletions.
2 changes: 1 addition & 1 deletion iroh-cli/src/commands/author.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion iroh-cli/src/commands/blob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down
12 changes: 6 additions & 6 deletions iroh-cli/src/commands/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down Expand Up @@ -293,7 +293,7 @@ pub enum Sorting {
/// Sort by key, then author
Key,
}
impl From<Sorting> for iroh::sync::store::SortBy {
impl From<Sorting> for iroh::docs::store::SortBy {
fn from(value: Sorting) -> Self {
match value {
Sorting::Author => Self::AuthorKey,
Expand Down Expand Up @@ -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!("<incomplete: {} ({})>", content, human_len(&entry))
}
iroh::sync::ContentStatus::Missing => {
iroh::docs::ContentStatus::Missing => {
let (Ok(content) | Err(content)) =
fmt_content(&doc, &entry, DisplayContentMode::ShortHash)
.await;
Expand Down
8 changes: 4 additions & 4 deletions iroh-cli/src/commands/doctor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand All @@ -37,7 +38,6 @@ use iroh::{
util::AbortingJoinHandle,
MagicEndpoint, NodeAddr, NodeId,
},
sync::{Capability, DocTicket},
util::{path::IrohPaths, progress::ProgressWriter},
};
use portable_atomic::AtomicU64;
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions iroh-cli/src/commands/start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ where
pub(crate) async fn start_node(
iroh_data_root: &Path,
relay_map: Option<RelayMap>,
) -> Result<Node<iroh::bytes::store::fs::Store>> {
) -> Result<Node<iroh::blobs::store::fs::Store>> {
let rpc_status = RpcStatus::load(iroh_data_root).await?;
match rpc_status {
RpcStatus::Running { port, .. } => {
Expand All @@ -141,7 +141,7 @@ pub(crate) async fn start_node(
.await
}

fn welcome_message<B: iroh::bytes::store::Store>(node: &Node<B>) -> Result<String> {
fn welcome_message<B: iroh::blobs::store::Store>(node: &Node<B>) -> Result<String> {
let msg = format!(
"{}\nNode ID: {}\n",
"Iroh is running".green(),
Expand Down
2 changes: 1 addition & 1 deletion iroh-cli/src/commands/tag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion iroh-cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
8 changes: 4 additions & 4 deletions iroh-cli/tests/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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<std::io::Result<Hash>> = db.blobs().await.unwrap().collect::<Vec<_>>();
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::<Vec<_>>();
drop(db);
assert_eq!(blobs.len(), 6);
Expand Down
2 changes: 1 addition & 1 deletion iroh/examples/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion iroh/examples/collection-fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion iroh/examples/collection-provide.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion iroh/examples/hello-world-fetch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions iroh/src/client/docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -509,13 +509,13 @@ pub enum LiveEvent {
SyncFinished(SyncEvent),
}

impl From<crate::sync_engine::LiveEvent> for LiveEvent {
fn from(event: crate::sync_engine::LiveEvent) -> LiveEvent {
impl From<crate::docs_engine::LiveEvent> 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,
Expand All @@ -524,10 +524,10 @@ impl From<crate::sync_engine::LiveEvent> 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),
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions iroh/src/sync_engine.rs → iroh/src/docs_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ToLiveActor>,
Expand All @@ -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
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions iroh/src/sync_engine/rpc.rs → iroh/src/docs_engine/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions iroh/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
#[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;

pub mod client;
pub mod node;
pub mod util;

mod docs_engine;
mod rpc_protocol;
mod sync_engine;

/// Expose metrics module
#[cfg(feature = "metrics")]
Expand Down
4 changes: 2 additions & 2 deletions iroh/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -105,7 +105,7 @@ struct NodeInner<D> {
gc_task: Option<AbortingJoinHandle<()>>,
#[debug("rt")]
rt: LocalPoolHandle,
pub(crate) sync: SyncEngine,
pub(crate) sync: Engine,
downloader: Downloader,
}

Expand Down
12 changes: 6 additions & 6 deletions iroh/src/node/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand All @@ -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 <https://simple.wikipedia.org/wiki/Leet>
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -710,11 +710,11 @@ async fn handle_connection<D: BaoStore>(
alpn: String,
node: Arc<NodeInner<D>>,
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,
Expand Down
2 changes: 1 addition & 1 deletion iroh/src/rpc_protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ use crate::{
node::NodeStatus,
tags::TagInfo,
},
sync_engine::LiveEvent,
docs_engine::LiveEvent,
};
pub use iroh_blobs::util::SetTagOption;

Expand Down
Loading

0 comments on commit d7f3214

Please sign in to comment.