Skip to main content

SwarmSpec

Trait SwarmSpec 

Source
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§

Source

fn network_id(&self) -> NetworkId

Network identifier used in compute_overlay and the BzzAddress sign-data.

Provided Methods§

Source

fn max_proximity_order(&self) -> ProximityOrder

Maximum proximity order (= number of bins minus one).

Source

fn saturation_peers(&self) -> u8

Minimum desired peers per bin before the bin is considered saturated. Bee default: 8 (defaultSaturationPeers).

Source

fn over_saturation_peers(&self) -> u8

Soft cap: above this, non-bootnode peers reject further inbound dials. Bee default: 18 (defaultOverSaturationPeers).

Source

fn bootnode_over_saturation_peers(&self) -> u8

Soft cap for bootnode mode (higher than regular). Bee default: 20 (defaultBootNodeOverSaturationPeers).

Source

fn neighborhood_low_watermark(&self) -> u8

Minimum peers required in the deepest bins to maintain neighborhood depth (bee default: 2 - nnLowWatermark).

Source

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.

Source

fn bin_count(&self) -> usize

Convenience: the routing-table bin count (max_proximity_order() + 1).

Source

fn max_bin(&self) -> Bin

Convenience: the deepest bin, derived from max_proximity_order.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§