netbeam
This is a pure-rust asynchronous network synchronization crate (using tokio) that recreates familiar asynchronous paradigms but in a network context.
Let A and B be two nodes with a pre-established ordered+reliable connection to each other (e.g., over TCP, TLS, QUIC, etc)
- join Given
Aexecuting functionf_a -> r_aandBexecuting functionf_b -> r_b, returnr_atoAandr_btoB - try_join Given
Aexecuting functionf_a -> Result<r_a>andBexecuting functionf_b -> Result<r_b>, returnResult<r_a>toAandResult<r_b>toBiffResult<r_a> = Ok(r_a)ANDResult<r_b> = Ok(r_b). A global error is returned if either one of the nodes fails - select Given
Aexecuting functionf_a -> r_aandBexecuting functionf_b -> r_b, returnr_atoAifr_ais computed first, or, returnr_btoBifr_bis computed first - try_select Given
Aexecuting functionf_a -> Result<r_a>andBexecuting functionf_b -> Result<r_b>, returnResult<r_a>toAifResult<r_a>is computed first ANDResult<r_a> = Ok(r_a), or, returnResult<r_b>toBifResult<r_b>is computed first ANDResult<r_b> = Ok(r_b). Returns a global error if both nodes fail.
NetMutex: A mutual exclusion algorithm for sharing memory in a synchronized mannor between two nodes NetRwLock: Allows a single writer or many readers between two nodes
Additionally, there is a sync_start file that allows the synchronization of two operations at approximately the same time.
Examples for every operation are in the source code under src/sync/[...]