1 unstable release

Uses new Rust 2021

0.6.0 Jul 5, 2022

#219 in Testing

Download history 26/week @ 2022-07-03 13/week @ 2022-07-10 20/week @ 2022-07-17 10/week @ 2022-07-24 10/week @ 2022-07-31 18/week @ 2022-08-07 9/week @ 2022-08-14 13/week @ 2022-08-21 8/week @ 2022-08-28 15/week @ 2022-09-04 9/week @ 2022-09-11 27/week @ 2022-09-18

62 downloads per month
Used in 3 crates

MIT/Apache

110KB
3K SLoC

Raw Fledger modules

This crate holds the raw modules for Fledger. They are written in a way to be as reusable as possible. For this, most modules have the following structure:

  • broker.rs - which contains the code to interact with the other modules
  • module.rs - with the main code of the module, with at least a process_msg method that inputs a message and outputs a vector of answers
  • data-structures - implementing the basic functionality of the module.

Currently the following modules are available:

  • random_connections takes a list of nodes and randomly selects enough nodes for a fully connected network
  • ping uses random_connections to send regular messages to the connected nodes to make sure they answer. If a node doesn't answer in due time, a failure message is emitted.
  • gossip_events exchanges events emitted by the nodes and updates the list. It works both in active mode - sending new messages to neighbours - as in passive mode - requesting list of available events from other nodes.

Broker

I wanted to create a common code for both the libc- and wasm-implementation for Fledger. Unfortunately it is difficult by the fact that libc allows to use threads (and sometimes needs them), so some structures need to have the Send and Sync traits. But these traits are not available for all necessary websys-modules! So I came up with the idea of linking all modules using a Broker system.

In short, all input and output for a module are defined as messages. Then each module handles incoming messages and produces outgoing messages. Modules can be linked together by defining Translators that take messages from one module and translate them into messages for the other module.

Dependencies

~7–11MB
~209K SLoC