From 4cce22504359489cced92d38a0671edce498cdd6 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Fri, 22 May 2020 11:06:26 +0200 Subject: [PATCH] Some guidelines --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 257278d..d656e1f 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,15 @@ export RUST_LOG=debug cargo run ``` +## Design Guidelines + +Diplonat is made of a set of Components. +Components communicate between them thanks to [tokio::sync::watch](https://docs.rs/tokio/0.2.21/tokio/sync/index.html#watch-channel) transferring copiable messages. +Each message must contain the whole state (and not a transition) as messages can be lost if a more recent message is received. +This choice has been made to limit bugs. +If you need to watch two actors and merge their content, you may use [tokio::sync::select](https://docs.rs/tokio/0.2.21/tokio/macro.select.html). +When you read a value from source 1, you must cache it to be able to merge it later when you read from source 2. + ## About Consul Catalog * We query the `/v1/catalog/node/` endpoint