unfinished chunking
This commit is contained in:
+1
-8
@@ -23,27 +23,19 @@ opt-level = 3
|
||||
[workspace.dependencies]
|
||||
## Crate members as common dependencies
|
||||
iroh_networking = { path = "iroh_networking" }
|
||||
util = { path = "util" }
|
||||
|
||||
# Macro dependecies
|
||||
extend = "1.2"
|
||||
delegate = "0.13"
|
||||
impl-trait-for-tuples = "0.2"
|
||||
derive_more = { version = "2.0.1", features = ["display"] }
|
||||
pin-project = "1"
|
||||
thiserror = "2"
|
||||
internment = "0.8"
|
||||
recursion = "0.5"
|
||||
once_cell = "1.21"
|
||||
bon = "3.4"
|
||||
keccak-const = "0.2"
|
||||
|
||||
# Async dependencies
|
||||
tokio = "1.46"
|
||||
n0-future = "0.3.1"
|
||||
|
||||
# Data structures
|
||||
either = "1.15"
|
||||
postcard = "1.1.3"
|
||||
n0-error = "0.1.2"
|
||||
|
||||
@@ -56,6 +48,7 @@ tracing-subscriber = "0.3.20"
|
||||
# networking
|
||||
iroh = "0.95.1"
|
||||
iroh-gossip = "0.95.0"
|
||||
bytes = "1.11.0"
|
||||
|
||||
# pyo3
|
||||
pyo3 = "0.27.1"
|
||||
|
||||
@@ -5,6 +5,9 @@ edition.workspace = true
|
||||
|
||||
[dependencies]
|
||||
blake3 = { workspace = true, features = ["neon", "rayon"] }
|
||||
bytemuck = { version = "1.24.0", features = ["derive"] }
|
||||
bytes.workspace = true
|
||||
extend.workspace = true
|
||||
iroh = { workspace = true, features = ["discovery-local-network"] }
|
||||
iroh-gossip = { workspace = true }
|
||||
log.workspace = true
|
||||
|
||||
@@ -19,6 +19,33 @@ use n0_error::{e, stack_error};
|
||||
use n0_future::{Stream, StreamExt};
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
pub mod ext {
|
||||
use bytemuck::Pod;
|
||||
use bytes::Bytes;
|
||||
use extend::ext;
|
||||
use iroh_gossip::api::{ApiError, GossipReceiver, GossipSender};
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
static FRAME_BUFFER: Mutex<Vec<MessageFrame>> = Mutex::const_new(Vec::new());
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Debug, Pod)]
|
||||
pub struct MessageChunk {
|
||||
pub frame_index: usize,
|
||||
pub content: Vec<u8>,
|
||||
}
|
||||
|
||||
#[ext(pub, name = GossipSenderExt)]
|
||||
impl GossipSender {
|
||||
async fn broadcast_with_chunking(&self, bytes: Bytes) -> Result<(), ApiError> {
|
||||
self.broadcast(message).await
|
||||
}
|
||||
}
|
||||
#[ext(pub, name = GossipReceiverExt)]
|
||||
impl GossipReceiver {
|
||||
async fn receive_with_chunking() {}
|
||||
}
|
||||
}
|
||||
|
||||
#[stack_error(derive, add_meta, from_sources)]
|
||||
pub enum Error {
|
||||
#[error(transparent)]
|
||||
@@ -145,26 +172,13 @@ fn str_to_topic_id(data: &str) -> TopicId {
|
||||
mod test {
|
||||
use std::{sync::Arc, time::Duration};
|
||||
|
||||
use iroh::{SecretKey, discovery::mdns::DiscoveryEvent};
|
||||
use iroh::SecretKey;
|
||||
use iroh_gossip::api::{Event, Message};
|
||||
use n0_future::StreamExt;
|
||||
use tokio::time::sleep;
|
||||
|
||||
use crate::ExoNet;
|
||||
|
||||
fn is_send<T: Send>(_: &T) {}
|
||||
|
||||
trait Probe: Send {}
|
||||
impl Probe for ExoNet {}
|
||||
impl Probe for DiscoveryEvent {}
|
||||
|
||||
#[test]
|
||||
fn test_is_send() {
|
||||
// todo: make rand a dev dep.
|
||||
let fut = ExoNet::init_iroh(SecretKey::generate(&mut rand::rng()), "");
|
||||
is_send(&fut);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_two_endpoints() {
|
||||
let net1 = Arc::new(
|
||||
|
||||
Reference in New Issue
Block a user