### 5 releases (breaking)

0.7.0 | Oct 4, 2023 |
---|---|

0.6.0 | Oct 4, 2023 |

0.5.0 | May 1, 2023 |

0.4.0 | Feb 8, 2023 |

0.3.0 | Jan 18, 2023 |

#**1963** in Network programming

**88** downloads per month

Used in **3** crates
(2 directly)

**MIT/Apache**

195KB

4K
SLoC

# netbeam

This is a pure-rust asynchronous network synchronization crate (using tokio) that recreates familiar asynchronous paradigms but in a network context.

Let

and `A`

be two nodes with a pre-established ordered+reliable connection to each other (e.g., over TCP, TLS, QUIC, etc)`B`

**join**Given

executing function`A`

and`f_a``->`r_a

executing function`B`

, return`f_b``->`r_b

to`r_a`

and`A`

to`r_b``B`**try_join**Given

executing function`A`

and`f_a``->``Result``<`r_a`>`

executing function`B`

, return`f_b``->``Result``<`r_b`>`

to`Result``<`r_a`>`

and`A`

to`Result``<`r_b`>`

iff`B`

AND`Result``<`r_a`>``=``Ok``(`r_a`)`

. A global error is returned if either one of the nodes fails`Result``<`r_b`>``=``Ok``(`r_b`)`**select**Given

executing function`A`

and`f_a``->`r_a

executing function`B`

, return`f_b``->`r_b

to`r_a`

if`A`

is computed first, or, return`r_a`

to`r_b`

if`B`

is computed first`r_b`**try_select**Given

executing function`A`

and`f_a``->``Result``<`r_a`>`

executing function`B`

, return`f_b``->``Result``<`r_b`>`

to`Result``<`r_a`>`

if`A`

is computed first AND`Result``<`r_a`>`

, or, return`Result``<`r_a`>``=``Ok``(`r_a`)`

to`Result``<`r_b`>`

if`B`

is computed first AND`Result``<`r_b`>`

. Returns a global error if both nodes fail.`Result``<`r_b`>``=``Ok``(`r_b`)`

**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

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/[...]`sync_start`

#### Dependencies

~5–14MB

~166K SLoC