Skip to content

Commit

Permalink
Merge branch 'main' into flub/messing-around-with-rtt
Browse files Browse the repository at this point in the history
  • Loading branch information
flub committed May 6, 2024
2 parents 3518b49 + d41f433 commit c380941
Show file tree
Hide file tree
Showing 55 changed files with 824 additions and 849 deletions.
21 changes: 19 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ jobs:
baseline-rev: ${{ env.HEAD_COMMIT_SHA }}
use-cache: false

check_fmt_and_docs:
check_fmt:
timeout-minutes: 30
name: Checking fmt and docs
name: Checking fmt
runs-on: ubuntu-latest
env:
RUSTC_WRAPPER: "sccache"
Expand All @@ -123,8 +123,25 @@ jobs:
- name: fmt
run: cargo fmt --all -- --check

check_docs:
timeout-minutes: 30
name: Checking docs
runs-on: ubuntu-latest
env:
RUSTC_WRAPPER: "sccache"
SCCACHE_GHA_ENABLED: "on"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2024-05-02
- name: Install sccache
uses: mozilla-actions/[email protected]

- name: Docs
run: cargo doc --workspace --all-features --no-deps --document-private-items
env:
RUSTDOCFLAGS: --cfg docsrs

clippy_check:
timeout-minutes: 30
Expand Down
5 changes: 4 additions & 1 deletion iroh-base/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ thiserror = "1"

# key module
aead = { version = "0.5.2", features = ["bytes"], optional = true }
derive_more = { version = "1.0.0-beta.1", features = ["debug", "display", "from_str"], optional = true }
derive_more = { version = "1.0.0-beta.6", features = ["debug", "display", "from_str"], optional = true }
ed25519-dalek = { version = "2.0.0", features = ["serde", "rand_core"], optional = true }
once_cell = { version = "1.18.0", optional = true }
rand = { version = "0.8", optional = true }
Expand All @@ -50,3 +50,6 @@ hash = ["dep:bao-tree", "dep:data-encoding", "dep:postcard", "dep:derive_more"]
base32 = ["dep:data-encoding"]
redb = ["dep:redb"]
key = ["dep:ed25519-dalek", "dep:once_cell", "dep:rand", "dep:rand_core", "dep:ssh-key", "dep:ttl_cache", "dep:aead", "dep:crypto_box", "dep:zeroize", "dep:url", "dep:derive_more"]

[package.metadata.docs.rs]
all-features = true
5 changes: 4 additions & 1 deletion iroh-bytes/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ anyhow = { version = "1" }
bao-tree = { version = "0.13", features = ["tokio_fsm"], default-features = false }
bytes = { version = "1.4", features = ["serde"] }
chrono = "0.4.31"
derive_more = { version = "1.0.0-beta.1", features = ["debug", "display", "deref", "deref_mut", "from", "try_into", "into"] }
derive_more = { version = "1.0.0-beta.6", features = ["debug", "display", "deref", "deref_mut", "from", "try_into", "into"] }
flume = "0.11"
futures-buffered = "0.2.4"
futures-lite = "2.3"
Expand Down Expand Up @@ -72,6 +72,9 @@ fs-store = ["dep:reflink-copy", "redb", "dep:redb_v1", "dep:tempfile"]
metrics = ["dep:iroh-metrics"]
redb = ["dep:redb"]

[package.metadata.docs.rs]
all-features = true

[[example]]
name = "provide-bytes"

Expand Down
2 changes: 1 addition & 1 deletion iroh-bytes/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Send data over the internet.
//! Blobs layer for iroh.
#![deny(missing_docs, rustdoc::broken_intra_doc_links)]
#![recursion_limit = "256"]
Expand Down
2 changes: 1 addition & 1 deletion iroh-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ clap = { version = "4", features = ["derive"] }
colored = "2.0.4"
comfy-table = "7.0.1"
console = "0.15.5"
derive_more = { version = "1.0.0-beta.1", features = ["display"] }
derive_more = { version = "1.0.0-beta.6", features = ["display"] }
dialoguer = { version = "0.11.0", default-features = false }
dirs-next = "2.0.0"
flume = "0.11.0"
Expand Down
6 changes: 3 additions & 3 deletions iroh-cli/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::path::{Path, PathBuf};
use anyhow::{ensure, Context, Result};
use clap::Parser;
use derive_more::FromStr;
use iroh::client::quic::Iroh as IrohRpc;
use iroh::client::QuicIroh;

use crate::config::{ConsoleEnv, NodeConfig};

Expand Down Expand Up @@ -127,7 +127,7 @@ impl Cli {
.await
} else {
crate::logging::init_terminal_logging()?;
let iroh = IrohRpc::connect(data_dir).await.context("rpc connect")?;
let iroh = QuicIroh::connect(data_dir).await.context("rpc connect")?;
console::run(&iroh, &env).await
}
}
Expand All @@ -144,7 +144,7 @@ impl Cli {
.await
} else {
crate::logging::init_terminal_logging()?;
let iroh = IrohRpc::connect(data_dir).await.context("rpc connect")?;
let iroh = QuicIroh::connect(data_dir).await.context("rpc connect")?;
command.run(&iroh, &env).await
}
}
Expand Down
4 changes: 2 additions & 2 deletions iroh-cli/src/commands/author.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use derive_more::FromStr;
use futures_lite::StreamExt;
use iroh::base::base32::fmt_short;

use iroh::client::{Iroh, RpcService};
use iroh::sync::{Author, AuthorId};
use iroh::{client::Iroh, rpc_protocol::ProviderService};
use quic_rpc::ServiceConnection;

use crate::config::ConsoleEnv;
Expand Down Expand Up @@ -34,7 +34,7 @@ pub enum AuthorCommands {
impl AuthorCommands {
pub async fn run<C>(self, iroh: &Iroh<C>, env: &ConsoleEnv) -> Result<()>
where
C: ServiceConnection<ProviderService>,
C: ServiceConnection<RpcService>,
{
match self {
Self::Switch { author } => {
Expand Down
51 changes: 27 additions & 24 deletions iroh-cli/src/commands/blob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,26 @@ use indicatif::{
HumanBytes, HumanDuration, MultiProgress, ProgressBar, ProgressDrawTarget, ProgressState,
ProgressStyle,
};
use iroh::net::{key::PublicKey, relay::RelayUrl, NodeAddr};
use iroh::{
base::node_addr::AddrInfoOptions,
base::ticket::BlobTicket,
bytes::{
get::{db::DownloadProgress, progress::BlobProgress, Stats},
provider::AddProgress,
store::{
ConsistencyCheckProgress, ExportFormat, ExportMode, ReportLevel, ValidateProgress,
},
util::SetTagOption,
BlobFormat, Hash, HashAndFormat, Tag,
},
};
use iroh::{
client::{BlobStatus, Iroh},
rpc_protocol::{
BlobDownloadRequest, BlobListCollectionsResponse, BlobListIncompleteResponse,
BlobListResponse, DownloadMode, ProviderService, SetTagOption, WrapOption,
client::{
blobs::{
BlobInfo, BlobStatus, CollectionInfo, DownloadMode, DownloadOptions,
IncompleteBlobInfo, WrapOption,
},
Iroh, RpcService,
},
ticket::BlobTicket,
net::{key::PublicKey, relay::RelayUrl, NodeAddr},
};
use quic_rpc::ServiceConnection;
use tokio::io::AsyncWriteExt;
Expand Down Expand Up @@ -183,7 +184,7 @@ impl std::str::FromStr for TicketOrHash {
impl BlobCommands {
pub async fn run<C>(self, iroh: &Iroh<C>) -> Result<()>
where
C: ServiceConnection<ProviderService>,
C: ServiceConnection<RpcService>,
{
match self {
Self::Get {
Expand Down Expand Up @@ -262,13 +263,15 @@ impl BlobCommands {

let mut stream = iroh
.blobs
.download(BlobDownloadRequest {
.download_with_opts(
hash,
format,
nodes: vec![node_addr],
tag,
mode,
})
DownloadOptions {
format,
nodes: vec![node_addr],
tag,
mode,
},
)
.await?;

show_download_progress(hash, &mut stream).await?;
Expand Down Expand Up @@ -446,27 +449,27 @@ pub enum ListCommands {
impl ListCommands {
pub async fn run<C>(self, iroh: &Iroh<C>) -> Result<()>
where
C: ServiceConnection<ProviderService>,
C: ServiceConnection<RpcService>,
{
match self {
Self::Blobs => {
let mut response = iroh.blobs.list().await?;
while let Some(item) = response.next().await {
let BlobListResponse { path, hash, size } = item?;
let BlobInfo { path, hash, size } = item?;
println!("{} {} ({})", path, hash, HumanBytes(size));
}
}
Self::IncompleteBlobs => {
let mut response = iroh.blobs.list_incomplete().await?;
while let Some(item) = response.next().await {
let BlobListIncompleteResponse { hash, size, .. } = item?;
let IncompleteBlobInfo { hash, size, .. } = item?;
println!("{} ({})", hash, HumanBytes(size));
}
}
Self::Collections => {
let mut response = iroh.blobs.list_collections().await?;
while let Some(item) = response.next().await {
let BlobListCollectionsResponse {
let CollectionInfo {
tag,
hash,
total_blobs_count,
Expand Down Expand Up @@ -506,7 +509,7 @@ pub enum DeleteCommands {
impl DeleteCommands {
pub async fn run<C>(self, iroh: &Iroh<C>) -> Result<()>
where
C: ServiceConnection<ProviderService>,
C: ServiceConnection<RpcService>,
{
match self {
Self::Blob { hash } => {
Expand Down Expand Up @@ -539,7 +542,7 @@ fn apply_report_level(text: String, level: ReportLevel) -> console::StyledObject

pub async fn consistency_check<C>(iroh: &Iroh<C>, verbose: u8, repair: bool) -> Result<()>
where
C: ServiceConnection<ProviderService>,
C: ServiceConnection<RpcService>,
{
let mut response = iroh.blobs.consistency_check(repair).await?;
let verbosity = get_report_level(verbose);
Expand Down Expand Up @@ -583,7 +586,7 @@ where

pub async fn validate<C>(iroh: &Iroh<C>, verbose: u8, repair: bool) -> Result<()>
where
C: ServiceConnection<ProviderService>,
C: ServiceConnection<RpcService>,
{
let mut state = ValidateProgressState::new();
let mut response = iroh.blobs.validate(repair).await?;
Expand Down Expand Up @@ -804,7 +807,7 @@ pub enum TicketOption {
Print,
}

pub async fn add_with_opts<C: ServiceConnection<ProviderService>>(
pub async fn add_with_opts<C: ServiceConnection<RpcService>>(
client: &iroh::client::Iroh<C>,
source: BlobSource,
opts: BlobAddOptions,
Expand Down Expand Up @@ -837,7 +840,7 @@ pub async fn add_with_opts<C: ServiceConnection<ProviderService>>(
}

/// Add data to iroh, either from a path or, if path is `None`, from STDIN.
pub async fn add<C: ServiceConnection<ProviderService>>(
pub async fn add<C: ServiceConnection<RpcService>>(
client: &iroh::client::Iroh<C>,
source: BlobSourceIroh,
tag: SetTagOption,
Expand Down
4 changes: 2 additions & 2 deletions iroh-cli/src/commands/console.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use anyhow::Result;
use clap::{Parser, Subcommand};
use colored::Colorize;
use iroh::base::base32::fmt_short;
use iroh::{client::Iroh, rpc_protocol::ProviderService};
use iroh::client::{Iroh, RpcService};
use quic_rpc::ServiceConnection;
use rustyline::{error::ReadlineError, Config, DefaultEditor};
use tokio::sync::{mpsc, oneshot};
Expand All @@ -14,7 +14,7 @@ use crate::{

pub async fn run<C>(iroh: &Iroh<C>, env: &ConsoleEnv) -> Result<()>
where
C: ServiceConnection<ProviderService>,
C: ServiceConnection<RpcService>,
{
println!("{}", "Welcome to the Iroh console!".purple().bold());
println!("Type `{}` for a list of commands.", "help".bold());
Expand Down
Loading

0 comments on commit c380941

Please sign in to comment.