Comments (4)
Here is the way I think we should change the API. Please feel free to comment. I propose to keep the DistAlgorithm
interface in a modified form for internal purposes, making it more automaton-like. At the moment DistAlgorithm
already has semantics close to that of an automaton - with Input
and Output
but without state. I believe that the interface should only have
-
a step function from inputs (and states, internally) to outputs and states,
-
types of input value, output value and state.
An input is an incoming message and an optional input value.
An output is a list of outgoing messages, a list of log entries and an optional output value. The caller #[must_use]
the output.
The usual type of state will be the set of four values:
a. not initialized (accepting incoming messages and input values),
b. initialized (accepting incoming messages and discarding input values),
c. terminated (discarding everything),
d. error.
The state value is a field in the algorithm struct
and is output at each step
, so there is no need to have an is_terminated
function to check for termination.
I think that keeping errors separate from state as in Result<OutputAndState, Error>
would only follow the requirements of external crates such as error_chain
and is not a necessity.
That was the easy part. So, what does it mean for the user of the library? If you use any of the algorithm struct
s directly, you must know the types of its input values, output values, messages and states. The top level API can provide an interface call to the step
function, so that using the DistAlgorithm
trait is not needed in user code.
from hbbft.
I agree with the plan for the outputs, and I like the idea of replacing multiple booleans (like terminated
) with a single state enum
, where possible.
An input is an incoming message and an optional input value.
I think we would end up only ever calling input(None, Some(input))
or input(Some(msg), None)
, so maybe it should be two separate functions.
from hbbft.
Let's also keep in mind the Rust API guidelines whenever we make changes to the API.
from hbbft.
I created an issue for that: #108.
from hbbft.
Related Issues (20)
- More tests: Honey Badger HOT 2
- More tests: DynamicHoneyBadger
- More tests (?): QueueingHoneyBadger
- Make non-threshold cryptography generic?
- Why isn't there an example telling how to use QueueingHoneyBadger with socket HOT 2
- Change the `Target` variants for less cloning and less duplicated code.
- Is there any solution to do some customized verification HOT 2
- Add a method for skipping the current epoch. HOT 3
- Vulnerability in memoffset.
- Add markdownlint to CI?
- Common coin in private network HOT 8
- Error Cargo.toml HOT 1
- Implement a journal, to persist and restore the algorithms' state? HOT 6
- API for use from other languages? HOT 1
- Infinite loop in QueueingHoneyBadger HOT 1
- Question regarding missed batch HOT 1
- question regarding operation mutiple nodes
- `failure` dependency CVE-2019-25010
- How do we save serialize Secret Key to Vec<u8>? HOT 1
- How to setup a network? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hbbft.