Skip to content

Commit

Permalink
refactor(iroh-sync): iroh-sync -> iroh-docs
Browse files Browse the repository at this point in the history
Closes #2270
  • Loading branch information
dignifiedquire committed May 6, 2024
1 parent 4c93f49 commit 2ec8813
Show file tree
Hide file tree
Showing 44 changed files with 111 additions and 111 deletions.
84 changes: 42 additions & 42 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ members = [
"iroh-gossip",
"iroh-metrics",
"iroh-net",
"iroh-sync",
"iroh-docs",
"iroh-test",
"iroh-net/bench",
"iroh-cli"
Expand Down
2 changes: 1 addition & 1 deletion iroh-sync/Cargo.toml → iroh-docs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "iroh-sync"
name = "iroh-docs"
version = "0.15.0"
edition = "2021"
readme = "README.md"
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion iroh-sync/README.md → iroh-docs/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# iroh-sync
# iroh-docs

Multi-dimensional key-value documents with an efficient synchronization protocol.

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion iroh-sync/src/actor.rs → iroh-docs/src/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ impl SyncHandle {
self.tx
.send_async(action)
.await
.context("sending to iroh_sync actor failed")?;
.context("sending to iroh_docs actor failed")?;
Ok(())
}
async fn send_replica(&self, namespace: NamespaceId, action: ReplicaAction) -> Result<()> {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion iroh-sync/src/keys.rs → iroh-docs/src/keys.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Keys used in iroh-sync
//! Keys used in iroh-docs
use std::{cmp::Ordering, fmt, str::FromStr};

Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions iroh-sync/src/metrics.rs → iroh-docs/src/metrics.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
//! Metrics for iroh-sync
//! Metrics for iroh-docs
use iroh_metrics::{
core::{Counter, Metric},
struct_iterable::Iterable,
};

/// Metrics for iroh-sync
/// Metrics for iroh-docs
#[allow(missing_docs)]
#[derive(Debug, Clone, Iterable)]
pub struct Metrics {
Expand Down Expand Up @@ -36,6 +36,6 @@ impl Default for Metrics {

impl Metric for Metrics {
fn name() -> &'static str {
"iroh_sync"
"iroh_docs"
}
}
10 changes: 5 additions & 5 deletions iroh-sync/src/net.rs → iroh-docs/src/net.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Network implementation of the iroh-sync protocol
//! Network implementation of the iroh-docs protocol
use std::{
future::Future,
Expand All @@ -20,8 +20,8 @@ use crate::metrics::Metrics;
#[cfg(feature = "metrics")]
use iroh_metrics::inc;

/// The ALPN identifier for the iroh-sync protocol
pub const SYNC_ALPN: &[u8] = b"/iroh-sync/1";
/// The ALPN identifier for the iroh-docs protocol
pub const DOCS_ALPN: &[u8] = b"/iroh-sync/1";

mod codec;

Expand All @@ -36,7 +36,7 @@ pub async fn connect_and_sync(
let peer_id = peer.node_id;
trace!("connect");
let connection = endpoint
.connect(peer, SYNC_ALPN)
.connect(peer, DOCS_ALPN)
.await
.map_err(ConnectError::connect)?;

Expand Down Expand Up @@ -103,7 +103,7 @@ pub enum AcceptOutcome {
Reject(AbortReason),
}

/// Handle an iroh-sync connection and sync all shared documents in the replica store.
/// Handle an iroh-docs connection and sync all shared documents in the replica store.
pub async fn handle_connection<F, Fut>(
sync: SyncHandle,
connecting: quinn::Connecting,
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion iroh-sync/src/store.rs → iroh-docs/src/store.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Storage trait and implementation for iroh-sync documents
//! Storage trait and implementation for iroh-docs documents
use std::num::NonZeroUsize;

use anyhow::Result;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions iroh-sync/src/sync.rs → iroh-docs/src/sync.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! API for iroh-sync replicas
//! API for iroh-docs replicas
// Names and concepts are roughly based on Willows design at the moment:
//
Expand Down Expand Up @@ -37,7 +37,7 @@ use crate::{
pub type ProtocolMessage = crate::ranger::Message<SignedEntry>;

/// Byte representation of a `PeerId` from `iroh-net`.
// TODO: PeerId is in iroh-net which iroh-sync doesn't depend on. Add iroh-base crate with `PeerId`.
// TODO: PeerId is in iroh-net which iroh-docs doesn't depend on. Add iroh-base crate with `PeerId`.
pub type PeerIdBytes = [u8; 32];

/// Max time in the future from our wall clock time that we accept entries for.
Expand Down
2 changes: 1 addition & 1 deletion iroh-sync/src/ticket.rs → iroh-docs/src/ticket.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Tickets for [`iroh-sync`] documents.
//! Tickets for [`iroh-docs`] documents.
use iroh_base::ticket;
use iroh_net::NodeAddr;
Expand Down
2 changes: 1 addition & 1 deletion iroh-gossip/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ readme = "README.md"
description = "gossip messages over broadcast trees"
license = "MIT/Apache-2.0"
authors = ["n0 team"]
repository = "https://github.com/n0-computer/iroh-sync"
repository = "https://github.com/n0-computer/iroh"

# Sadly this also needs to be updated in .github/workflows/ci.yml
rust-version = "1.75"
Expand Down
2 changes: 1 addition & 1 deletion iroh/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ iroh-metrics = { version = "0.15.0", path = "../iroh-metrics", optional = true }
iroh-net = { version = "0.15.0", path = "../iroh-net" }
num_cpus = { version = "1.15.0" }
portable-atomic = "1"
iroh-sync = { version = "0.15.0", path = "../iroh-sync" }
iroh-docs = { version = "0.15.0", path = "../iroh-docs" }
iroh-gossip = { version = "0.15.0", path = "../iroh-gossip" }
parking_lot = "0.12.1"
postcard = { version = "1", default-features = false, features = ["alloc", "use-std", "experimental-derive"] }
Expand Down
2 changes: 1 addition & 1 deletion iroh/src/client/authors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use anyhow::Result;
use futures_lite::{stream::StreamExt, Stream};
use iroh_sync::{Author, AuthorId};
use iroh_docs::{Author, AuthorId};
use quic_rpc::{RpcClient, ServiceConnection};

use crate::rpc_protocol::{
Expand Down
14 changes: 7 additions & 7 deletions iroh/src/client/docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ use derive_more::{Display, FromStr};
use futures_lite::{Stream, StreamExt};
use iroh_base::{key::PublicKey, node_addr::AddrInfoOptions};
use iroh_blobs::{export::ExportProgress, store::ExportMode, Hash};
use iroh_net::NodeAddr;
use iroh_sync::{
use iroh_docs::{
actor::OpenState,
store::{DownloadPolicy, Query},
AuthorId, CapabilityKind, ContentStatus, DocTicket, NamespaceId, PeerIdBytes, RecordIdentifier,
};
use iroh_net::NodeAddr;
use portable_atomic::{AtomicBool, Ordering};
use quic_rpc::{message::RpcMsg, RpcClient, ServiceConnection};
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -395,16 +395,16 @@ impl<'a, C: ServiceConnection<RpcService>> From<&'a Doc<C>> for &'a RpcClient<Rp

/// A single entry in a [`Doc`].
#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
pub struct Entry(iroh_sync::Entry);
pub struct Entry(iroh_docs::Entry);

impl From<iroh_sync::Entry> for Entry {
fn from(value: iroh_sync::Entry) -> Self {
impl From<iroh_docs::Entry> for Entry {
fn from(value: iroh_docs::Entry) -> Self {
Self(value)
}
}

impl From<iroh_sync::SignedEntry> for Entry {
fn from(value: iroh_sync::SignedEntry) -> Self {
impl From<iroh_docs::SignedEntry> for Entry {
fn from(value: iroh_docs::SignedEntry) -> Self {
Self(value.into())
}
}
Expand Down
4 changes: 2 additions & 2 deletions iroh/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ pub use iroh_base as base;
#[doc(inline)]
pub use iroh_blobs as bytes;
#[doc(inline)]
pub use iroh_net as net;
pub use iroh_docs as sync;
#[doc(inline)]
pub use iroh_sync as sync;
pub use iroh_net as net;

pub mod client;
pub mod node;
Expand Down
4 changes: 2 additions & 2 deletions iroh/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl Metric for Metrics {
pub fn try_init_metrics_collection() -> std::io::Result<()> {
iroh_metrics::core::Core::try_init(|reg, metrics| {
metrics.insert(crate::metrics::Metrics::new(reg));
metrics.insert(iroh_sync::metrics::Metrics::new(reg));
metrics.insert(iroh_docs::metrics::Metrics::new(reg));
metrics.insert(iroh_net::metrics::MagicsockMetrics::new(reg));
metrics.insert(iroh_net::metrics::NetcheckMetrics::new(reg));
metrics.insert(iroh_net::metrics::PortmapMetrics::new(reg));
Expand All @@ -54,7 +54,7 @@ pub fn get_metrics() -> anyhow::Result<BTreeMap<String, CounterStats>> {
let core =
iroh_metrics::core::Core::get().ok_or_else(|| anyhow::anyhow!("metrics are disabled"))?;
collect(
core.get_collector::<iroh_sync::metrics::Metrics>(),
core.get_collector::<iroh_docs::metrics::Metrics>(),
&mut map,
);
collect(
Expand Down
Loading

0 comments on commit 2ec8813

Please sign in to comment.