Skip to content

Commit

Permalink
feat: Retrieve replicas by ID
Browse files Browse the repository at this point in the history
  • Loading branch information
emmyoh committed May 6, 2024
1 parent 062eebb commit 4d45cda
Show file tree
Hide file tree
Showing 5 changed files with 242 additions and 83 deletions.
6 changes: 4 additions & 2 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ miette = { version = "7.2.0", features = ["fancy"] }
path-clean = "1.0.1"
postcard = "1.0.8"
quic-rpc = "0.7.0"
quinn = "0.10.2"
rand_core = "0.6.4"
serde = "1.0.197"
serde_json = "1.0.116"
sha3 = "0.10.8"
thiserror = "1.0.58"
tokio = "1.37.0"
22 changes: 21 additions & 1 deletion src/discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ use futures::StreamExt;
use iroh::{
bytes::{Hash, HashAndFormat},
sync::NamespaceId,
ticket::BlobTicket,
ticket::{BlobTicket, DocTicket},
};
use iroh_mainline_content_discovery::announce_dht;
use serde::{Deserialize, Serialize};
use std::path::PathBuf;
use std::{collections::BTreeSet, error::Error, str::FromStr, time::Duration};

/// The delay between republishing content to the mainline DHT.
Expand Down Expand Up @@ -149,3 +151,21 @@ impl FromStr for ContentRequest {

// Ok(())
// }

#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum PeerTicketResponse {
Document(DocTicket),
Entries(Vec<BlobTicket>),
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PeerContentRequest {
pub namespace_id: NamespaceId,
pub path: Option<PathBuf>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct PeerContentResponse {
pub ticket_response: PeerTicketResponse,
pub content_size: u64,
}
Loading

0 comments on commit 4d45cda

Please sign in to comment.