Crates.io | links_blocking |
lib.rs | links_blocking |
version | 0.2.12 |
source | src |
created_at | 2024-01-02 23:14:32.16065 |
updated_at | 2024-02-24 00:37:56.342374 |
description | Blocking implementation of links_blocking crate |
homepage | |
repository | https://github.com/softstream-link/links |
max_upload_size | |
id | 1086771 |
size | 84,922 |
Traditionally, network api provide methods that exposes access to very low level byte arrays
of data where as an application layer prefers to work with struct
s which carry information about application state.
Rust's std::net module is not an exception and it leaves developer with the responsibility to interpret the byte array
by performing a number of steps to extract a single frame of bytes from that array, convert it into a desired data structure, while keeping track of remaining bytes and managing a lot of other details. The implementation details here have direct impact on application performance and reliability.
Even once those details have been addressed, the developer has to solve for many additional tasks such as:
This library addresses above challenges, while providing a highly performant network code without imposing limitations on how application wishes to use the api.
At a very high level The main concept is based on the the following two struct
ures
Clt
- this is a network client and can initiate a connectionSvc
- this is a network service which listens to a port and creates a Clt
for each established connectionClt
and Svc
then provide and send
and recv
methods with a signature that roughly looks like this:
Clt::send(msg: &T)
vs Clt::recv() -> T
- where T
is a generic type that you specify when instantiating a Clt
and Svc
There are three implementations of this library. Follow individual links for more details
send()
/recv()
methods take a timeout
argument. This allows the application developer to set io
wait limits. The internal implementation relies on spin
locks and waits to provide best
latency performance as it does not let OS
to park the running thread, which incurs significant latency penalty. This implementation is recommended for cases with low latency
performance requirement.async
/await
tokio
framework, however, at the moment of this writing Rust's async api is still going through stabilization and is not yet available on stable
toolchain.