Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: renames iroh-sync & iroh-bytes #2271

Merged
merged 5 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
# uses: obi1kenobi/cargo-semver-checks-action@v2
uses: n0-computer/cargo-semver-checks-action@feat-baseline
with:
package: iroh, iroh-base, iroh-bytes, iroh-cli, iroh-dns-server, iroh-gossip, iroh-metrics, iroh-net, iroh-sync
package: iroh, iroh-base, iroh-blobs, iroh-cli, iroh-dns-server, iroh-gossip, iroh-metrics, iroh-net, iroh-docs
baseline-rev: ${{ env.HEAD_COMMIT_SHA }}
use-cache: false

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ env:
RUSTFLAGS: -Dwarnings
RUSTDOCFLAGS: -Dwarnings
SCCACHE_CACHE_SIZE: "50G"
CRATES_LIST: "iroh,iroh-bytes,iroh-gossip,iroh-metrics,iroh-net,iroh-sync,iroh-test,iroh-cli,iroh-dns-server"
CRATES_LIST: "iroh,iroh-blobs,iroh-gossip,iroh-metrics,iroh-net,iroh-docs,iroh-test,iroh-cli,iroh-dns-server"

jobs:
build_and_test_nix:
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
uses: taiki-e/install-action@v2
with:
tool: nextest

- name: Install sccache
uses: mozilla-actions/[email protected]

Expand Down
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.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[workspace]
members = [
"iroh",
"iroh-bytes",
"iroh-blobs",
"iroh-base",
"iroh-dns-server",
"iroh-gossip",
"iroh-metrics",
"iroh-net",
"iroh-sync",
"iroh-docs",
"iroh-test",
"iroh-net/bench",
"iroh-cli"
Expand Down
4 changes: 2 additions & 2 deletions iroh-bytes/Cargo.toml → iroh-blobs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "iroh-bytes"
name = "iroh-blobs"
version = "0.15.0"
edition = "2021"
readme = "README.md"
Expand Down Expand Up @@ -52,7 +52,7 @@ tracing-futures = "0.2.5"

[dev-dependencies]
http-body = "0.4.5"
iroh-bytes = { path = ".", features = ["downloader"] }
iroh-blobs = { path = ".", features = ["downloader"] }
iroh-test = { path = "../iroh-test" }
futures-buffered = "0.2.4"
proptest = "1.0.0"
Expand Down
4 changes: 2 additions & 2 deletions iroh-bytes/README.md → iroh-blobs/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# iroh-bytes
# iroh-blobs

This crate provides blob and collection transfer support for iroh. It implements a simple request-response protocol based on blake3 verified streaming.

Expand All @@ -23,7 +23,7 @@ This crate is usually used together with [iroh-net](https://crates.io/crates/iro

## Examples

Examples that use `iroh-bytes` can be found in the `iroh` crate. the iroh crate publishes `iroh_bytes` as `iroh::bytes`.
Examples that use `iroh-blobs` can be found in the `iroh` crate. the iroh crate publishes `iroh_blobs` as `iroh::bytes`.


# License
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use anyhow::{Context, Result};
use iroh_io::ConcatenateSliceWriter;
use tracing_subscriber::{prelude::*, EnvFilter};

use iroh_bytes::{
use iroh_blobs::{
get::fsm::{AtInitial, ConnectedNext, EndBlobNext},
hashseq::HashSeq,
protocol::GetRequest,
Expand Down Expand Up @@ -64,14 +64,14 @@ async fn main() -> Result<()> {
// create a request for a collection
let request = GetRequest::all(hash);
// create the initial state of the finite state machine
let initial = iroh_bytes::get::fsm::start(connection, request);
let initial = iroh_blobs::get::fsm::start(connection, request);

write_collection(initial).await
} else {
// create a request for a single blob
let request = GetRequest::single(hash);
// create the initial state of the finite state machine
let initial = iroh_bytes::get::fsm::start(connection, request);
let initial = iroh_blobs::get::fsm::start(connection, request);

write_blob(initial).await
}
Expand Down Expand Up @@ -120,7 +120,7 @@ async fn write_collection(initial: AtInitial) -> Result<()> {
}

// move to the header
let header: iroh_bytes::get::fsm::AtBlobHeader = start_root.next();
let header: iroh_blobs::get::fsm::AtBlobHeader = start_root.next();
let (root_end, hashes_bytes) = header.concatenate_into_vec().await?;
let next = root_end.next();
let EndBlobNext::MoreChildren(at_meta) = next else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use genawaiter::sync::Co;
use genawaiter::sync::Gen;
use tokio::io::AsyncWriteExt;

use iroh_bytes::{
use iroh_blobs::{
get::fsm::{AtInitial, BlobContentNext, ConnectedNext, EndBlobNext},
hashseq::HashSeq,
protocol::GetRequest,
Expand Down Expand Up @@ -73,7 +73,7 @@ async fn main() -> Result<()> {
let request = GetRequest::all(hash);

// create the initial state of the finite state machine
let initial = iroh_bytes::get::fsm::start(connection, request);
let initial = iroh_blobs::get::fsm::start(connection, request);

// create a stream that yields all the data of the blob
stream_children(initial).boxed_local()
Expand All @@ -82,7 +82,7 @@ async fn main() -> Result<()> {
let request = GetRequest::single(hash);

// create the initial state of the finite state machine
let initial = iroh_bytes::get::fsm::start(connection, request);
let initial = iroh_blobs::get::fsm::start(connection, request);

// create a stream that yields all the data of the blob
stream_blob(initial).boxed_local()
Expand Down Expand Up @@ -171,7 +171,7 @@ fn stream_children(initial: AtInitial) -> impl Stream<Item = io::Result<Bytes>>
));
}
// move to the header
let header: iroh_bytes::get::fsm::AtBlobHeader = start_root.next();
let header: iroh_blobs::get::fsm::AtBlobHeader = start_root.next();
let (root_end, hashes_bytes) = header.concatenate_into_vec().await?;

// parse the hashes from the hash sequence bytes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use anyhow::Result;
use tokio_util::task::LocalPoolHandle;
use tracing_subscriber::{prelude::*, EnvFilter};

use iroh_bytes::{format::collection::Collection, Hash};
use iroh_blobs::{format::collection::Collection, Hash};

mod connect;
use connect::{make_and_write_certs, make_server_endpoint, CERT_PATH};
Expand Down Expand Up @@ -47,7 +47,7 @@ async fn main() -> Result<()> {
println!("\nprovide bytes {format} example!");

let (db, hash) = if format == "collection" {
let (mut db, names) = iroh_bytes::store::readonly_mem::Store::new([
let (mut db, names) = iroh_blobs::store::readonly_mem::Store::new([
("blob1", b"the first blob of bytes".to_vec()),
("blob2", b"the second blob of bytes".to_vec()),
]); // create a collection
Expand All @@ -61,7 +61,7 @@ async fn main() -> Result<()> {
} else {
// create a new database and add a blob
let (db, names) =
iroh_bytes::store::readonly_mem::Store::new([("hello", b"Hello World!".to_vec())]);
iroh_blobs::store::readonly_mem::Store::new([("hello", b"Hello World!".to_vec())]);

// get the hash of the content
let hash = names.get("hello").unwrap();
Expand Down Expand Up @@ -92,7 +92,7 @@ async fn main() -> Result<()> {

// spawn a task to handle the connection
tokio::spawn(async move {
iroh_bytes::provider::handle_connection(conn, db, MockEventSender, lp).await
iroh_blobs::provider::handle_connection(conn, db, MockEventSender, lp).await
});
}
});
Expand All @@ -112,8 +112,8 @@ struct MockEventSender;

use futures_lite::future::FutureExt;

impl iroh_bytes::provider::EventSender for MockEventSender {
fn send(&self, _event: iroh_bytes::provider::Event) -> futures_lite::future::Boxed<()> {
impl iroh_blobs::provider::EventSender for MockEventSender {
fn send(&self, _event: iroh_blobs::provider::Event) -> futures_lite::future::Boxed<()> {
async move {}.boxed()
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion iroh-bytes/src/get/db.rs → iroh-blobs/src/get/db.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Functions that use the iroh-bytes protocol in conjunction with a bao store.
//! Functions that use the iroh-blobs protocol in conjunction with a bao store.

use std::future::Future;
use std::io;
Expand Down
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-bytes/src/metrics.rs → iroh-blobs/src/metrics.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Metrics for iroh-bytes
//! Metrics for iroh-blobs

use iroh_metrics::{
core::{Counter, Metric},
Expand Down Expand Up @@ -30,6 +30,6 @@ impl Default for Metrics {

impl Metric for Metrics {
fn name() -> &'static str {
"iroh-bytes"
"iroh-blobs"
}
}
Loading
Loading