pub trait SwarmSpec {
// Required method
fn network_id(&self) -> NetworkId;
// Provided methods
fn max_proximity_order(&self) -> ProximityOrder { ... }
fn saturation_peers(&self) -> u8 { ... }
fn over_saturation_peers(&self) -> u8 { ... }
fn bootnode_over_saturation_peers(&self) -> u8 { ... }
fn neighborhood_low_watermark(&self) -> u8 { ... }
fn clock_skew_tolerance(&self) -> Duration { ... }
fn bin_count(&self) -> usize { ... }
fn max_bin(&self) -> Bin { ... }
}Expand description
Canonical Swarm network spec.
Default-method bodies mirror bee’s hard-coded constants. Implementors only
have to provide network_id; they may override any of the others to
customise a deployment (e.g. a dense testnet with tighter saturation).
Trait can grow with default methods without breaking implementors -
#[non_exhaustive] is not a valid attribute on traits in Rust, but the
default-method discipline gives equivalent backward-compatibility.
Required Methods§
Sourcefn network_id(&self) -> NetworkId
fn network_id(&self) -> NetworkId
Network identifier used in compute_overlay
and the BzzAddress sign-data.
Provided Methods§
Sourcefn max_proximity_order(&self) -> ProximityOrder
fn max_proximity_order(&self) -> ProximityOrder
Maximum proximity order (= number of bins minus one).
Sourcefn saturation_peers(&self) -> u8
fn saturation_peers(&self) -> u8
Minimum desired peers per bin before the bin is considered saturated.
Bee default: 8 (defaultSaturationPeers).
Sourcefn over_saturation_peers(&self) -> u8
fn over_saturation_peers(&self) -> u8
Soft cap: above this, non-bootnode peers reject further inbound dials.
Bee default: 18 (defaultOverSaturationPeers).
Sourcefn bootnode_over_saturation_peers(&self) -> u8
fn bootnode_over_saturation_peers(&self) -> u8
Soft cap for bootnode mode (higher than regular).
Bee default: 20 (defaultBootNodeOverSaturationPeers).
Sourcefn neighborhood_low_watermark(&self) -> u8
fn neighborhood_low_watermark(&self) -> u8
Minimum peers required in the deepest bins to maintain neighborhood
depth (bee default: 2 - nnLowWatermark).
Sourcefn clock_skew_tolerance(&self) -> Duration
fn clock_skew_tolerance(&self) -> Duration
Maximum clock skew permitted between local and remote timestamps
during handshake / hive verification. Bee’s bzz/timestamp.go
hard-codes 5s but operational deployments commonly relax to minutes
or hours; this default is 6h to match what was previously embedded
in vertex.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".