II · Four primitives
Composable subsystems, accessed from a single Network.
Each primitive is independently useful and composes cleanly with the others. Applications
pick the surface they need: gossip alone, pub/sub over gossip, consensus groups on top of
pub/sub, or replicated collections on top of groups.
01 — Discovery
Gossip, catalog, tags.
Every node broadcasts its presence, capabilities, and the streams/groups/stores it offers.
Two protocols compose: signed real-time announcements via iroh-gossip,
and bidirectional catalog sync for initial catch-up. Transparent by default;
tunable via NetworkBuilder.
let network = Network::new(network_id).await?;
// the node is now online and discoverable
02 — Streams
Typed async pub/sub.
Producers and consumers connected across the swarm by Rust type.
Predicates, limits, online conditions, per-subscription stats, backpressure.
let p = network.streams().produce::<Block>();
let c = network.streams().consume::<Block>();
03 — Groups
Raft, retuned for trust.
Bonded mesh, non-voting followers, dynamic quorum, parallel log catch-up.
let g = network.groups()
.with_state_machine(sm)
.join().await?;
04 — Collections
Replicated data structures on top of Groups.
Map,
Vec,
Set,
Cell,
Once,
PriorityQueue.
Each has a writer and any number of readers; every mutation returns a
Version readers can await via
when().reaches(v).
let map = collections::Map::<String, u64>::new(&network, store_id);
map.insert("alice".into(), 100).await?;
// readers on other nodes converge automatically