pub struct NetworkBuilder { /* private fields */ }Expand description
Builder for configuring and creating a test network
Implementations§
Source§impl NetworkBuilder
impl NetworkBuilder
pub fn new() -> Self
Sourcepub fn binary(self, binary: FreenetBinary) -> Self
pub fn binary(self, binary: FreenetBinary) -> Self
Set which freenet binary to use
Sourcepub fn require_connectivity(self, ratio: f64) -> Self
pub fn require_connectivity(self, ratio: f64) -> Self
Set minimum connectivity ratio required (0.0 to 1.0)
Sourcepub fn connectivity_timeout(self, timeout: Duration) -> Self
pub fn connectivity_timeout(self, timeout: Duration) -> Self
Set timeout for connectivity check
Sourcepub fn min_connections(self, min: usize) -> Self
pub fn min_connections(self, min: usize) -> Self
Override min connections target for all peers.
Sourcepub fn max_connections(self, max: usize) -> Self
pub fn max_connections(self, max: usize) -> Self
Override max connections target for all peers.
Sourcepub fn start_stagger(self, delay: Duration) -> Self
pub fn start_stagger(self, delay: Duration) -> Self
Add a delay between starting successive non-gateway peers.
Sourcepub fn preserve_temp_dirs_on_failure(self, preserve: bool) -> Self
pub fn preserve_temp_dirs_on_failure(self, preserve: bool) -> Self
Preserve peer data directories in /tmp when network startup fails
Sourcepub fn preserve_temp_dirs_on_success(self, preserve: bool) -> Self
pub fn preserve_temp_dirs_on_success(self, preserve: bool) -> Self
Preserve peer data directories in /tmp even when the network boots successfully.
Sourcepub fn peer_location(self, index: usize, location: PeerLocation) -> Self
pub fn peer_location(self, index: usize, location: PeerLocation) -> Self
Set the location for a specific peer (by index) Index 0 is the first gateway, subsequent indices are regular peers
Sourcepub fn default_location(self, location: PeerLocation) -> Self
pub fn default_location(self, location: PeerLocation) -> Self
Set the default location for all peers not explicitly configured
Sourcepub fn distribute_across_remotes(self, machines: Vec<RemoteMachine>) -> Self
pub fn distribute_across_remotes(self, machines: Vec<RemoteMachine>) -> Self
Convenience method to set locations for multiple remote machines Distributes peers across the provided machines in round-robin fashion
Sourcepub fn backend(self, backend: Backend) -> Self
pub fn backend(self, backend: Backend) -> Self
Set the backend for running peers (Local or DockerNat)
Sourcepub async fn build(self) -> Result<TestNetwork>
pub async fn build(self) -> Result<TestNetwork>
Build and start the network (async)
Sourcepub fn build_sync(self) -> Result<TestNetwork>
pub fn build_sync(self) -> Result<TestNetwork>
Build the network synchronously (for use in LazyLock)