Skip to content

Commit

Permalink
Add free fns for one way partition and repair (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcches authored Oct 9, 2024
1 parent 9a3da11 commit ae4e2c0
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,13 @@ pub fn partition(a: impl ToIpAddrs, b: impl ToIpAddrs) {
World::current(|world| world.partition_many(a, b))
}

/// Partition two hosts, or sets of hosts, in one direction.
///
/// Must be called from within a Turmoil simulation.
pub fn partition_oneway(from: impl ToIpAddrs, to: impl ToIpAddrs) {
World::current(|world| world.partition_oneway_many(from, to))
}

/// Repair the connection between two hosts, or sets of hosts, resulting in
/// messages to be delivered.
///
Expand All @@ -247,6 +254,13 @@ pub fn repair(a: impl ToIpAddrs, b: impl ToIpAddrs) {
World::current(|world| world.repair_many(a, b))
}

/// Repair the connection between two hosts, or sets of hosts, in one direction.
///
/// Must be called from within a Turmoil simulation.
pub fn repair_oneway(from: impl ToIpAddrs, to: impl ToIpAddrs) {
World::current(|world| world.repair_oneway_many(from, to))
}

/// Return the number of established tcp streams on the current host.
pub fn established_tcp_stream_count() -> usize {
World::current(|world| world.est_tcp_streams())
Expand Down

0 comments on commit ae4e2c0

Please sign in to comment.