bytesandbrains provides composable, transport-agnostic building blocks for peer-to-peer overlay networks and distributed machine learning.
Quick Start
[]
= { = "0.1", = ["full"] }
Or pick only what you need:
[]
= { = "0.1", = ["gossip", "proto"] }
Workspace
| Crate | Description |
|---|---|
| bb-core | Shared traits and types: Address, PeerId, Peer, OverlayProtocol, PeerSampling, Embedding/EmbeddingSpace, and distance metrics (optional SIMD via simsimd). |
| bb-overlay | Protocol implementations built on bb-core. |
| bb-codec | Product Quantization: ProductQuantizer, PQCode, distance tables for approximate nearest neighbor search. |
| bb-index | Vector indexing: FlatIndex with add/search/remove/train operations. |
| bb-ml | Machine learning utilities: K-Means clustering. |
Protocols
Gossip Peer Sampling
A gossip-based peer sampling framework built on the T-Man protocol abstraction. The gossip loop (poll, message handling, request tracking) is written once, and peer selection and view exchange strategies are pluggable via traits:
PeerSelector<P, A>: Controls which peer to gossip with. Ships withRandomizedSelector(Tail / UniformRandom modes).ViewExchange<P, A>: Controls how views are prepared and merged. Ships withRandomizedExchange(healing/swap eviction with age tracking).GossipPeerType<A>: Trait for peer types. Ships withAgePeer<A>for age-based ranking.
RandomizedGossip<A> is the standard type alias combining all three for the classic randomized gossip protocol.
Feature Flags
| Flag | Description |
|---|---|
gossip |
Gossip peer sampling protocol |
codec |
Product quantization codec |
index |
Vector indexing structures |
ml |
ML utilities (k-means) |
proto |
Protocol Buffers serialization (via prost) |
simd |
SIMD-accelerated distance functions |
full |
All of the above |
License
GPL-2.0