Add a new quorum call option with strict ordering #52
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request adds a new quorum call option,
qc_strict_ordering
, that has strict ordering of messages due to its use of streams. The code is being used for an implementation of HotStuff in https://github.com/relab/hotstuff (Currently a private repo, not sure who has access).The code is similar to the stream based approach suggested by @meling in #16. The major difference is that each node runs two goroutines on
Node.connect()
:Send
channel and sends them on the stream.The reason for using these two goroutines per Node is that it avoids waiting for a response. In other words, multiple messages can be sent to a Node independently of how many replies it has sent back.
Because of this behavior it is necessary to give each request/response pair a unique ID. I did not find a clever way to embed this ID field in the messages. Thus it is currently required that the user specifies the name of a common field in both the request and response fields of a method with an unsigned integer type that can be used by gorums. See the example below:
A counter in
Manager
is used to generate the message IDs.Additionally, a map of message IDs to channels is used to provide a way for Nodes to send the response messages back to the quorum call function.
A helper function is generated to simplify the server implementation: