readme to describe the strategies

This commit is contained in:
GroovieGermanikus 2023-12-15 09:41:02 +01:00
parent fd509cda67
commit b894104489
No known key found for this signature in database
GPG Key ID: 5B6EB831A5CD2015
1 changed files with 25 additions and 0 deletions

25
README.md Normal file
View File

@ -0,0 +1,25 @@
## _Fastest Wins Strategy_ using Futures (recommended)
We recommend to use the `grpcmultiplex_fastestwins` implementation based on _Futures_.
You can take the example code from `stream_blocks_mainnet.rs`.
__Reconnects__ will handled transparently in inside the _Futures_.
Multiple _Futures_ are executed in parallel and the first result is returned.
No __guarantees__ are made about if the messages are continuous or not.
## _Fastest Wins Strategy_ using task/channel (experimental)
(see `grpcmultiplex_fastestwins_channels.rs`)
This implementation is built with _Tokio Tasks and Channels_ instead of futures.
It is simpler and more predictable than the _Futures_ implementation.
It uses a _push model_ rather than a _pull model_, i.e. the _task_ pushes the result to the _channel_ while the _Futures_ implementation pulls the result from the chain of _Futures_.
## _Perfect Seq Strategy_ (experimental)
(see `grpcmultiplex_perfectseq.rs`)
This strategy **guarantees** that the messages are **continuous** and in the **correct order**.
The _continuous_ property is defined by linking a _Block_ with previous _Block_ using `block.parent_slot` and `block.parent_hash`.
The **disadvantage** is that it will not produce messages if a _Block_ is missing.
It is limited to the commitment levels __confirmed__ and __finalized__. For __processed__ level there is no sequence due to the potential presence of forks with form a tree.