use std::sync::mpsc::Sender;
use triblespace_core::id::Id;
use crate::protocol::{RawBranchId, RawHash};
pub type PublisherKey = [u8; 32];
pub enum NetCommand {
Announce(RawHash),
Gossip { branch: RawBranchId, head: RawHash },
Track { peer: iroh_base::EndpointAddr, branch: RawBranchId },
ListBranches {
peer: iroh_base::EndpointAddr,
reply: Sender<anyhow::Result<Vec<(Id, RawHash)>>>,
},
HeadOfRemote {
peer: iroh_base::EndpointAddr,
branch: RawBranchId,
reply: Sender<anyhow::Result<Option<RawHash>>>,
},
Fetch {
peer: iroh_base::EndpointAddr,
hash: RawHash,
reply: Sender<anyhow::Result<Option<Vec<u8>>>>,
},
}
#[derive(Debug)]
pub enum NetEvent {
Blob(Vec<u8>),
Head { branch: RawBranchId, head: RawHash, publisher: PublisherKey },
}