-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is a larger refactoring of storage APIs to allow more clear ownership of data. RaftStorage is now refactored to: - RaftLogReader to read data from the log in parallel tasks independent of the main Raft loop - RaftStorage to modify the log and the state machine (implements also RaftLogReader) intended to be used in the main Raft loop - RaftSnapshotBuilder to build the snapshot in background independent of the main Raft loop The RaftStorage API offers to create new RaftLogReader or RaftSnapshotBuilder on it. RaftNetwork is also refactored to: - RaftNetwork responsible for sending RPCs - RaftNetworkFactory responsible for creating instances of RaftNetwork for sending data to a particular node All these traits now take &mut self, so it's possible to heavily optimize a lot of stuff by removing any synchronization/lookups and in general to streamline the implementation of the "real" store and network. All traits are built in such a way that they can be implemented for Arc<T> (or similar) to basically model the original behaviour with &self receiver. DefensiveCheck was also split to DefensiveCheckBase and DefensiveCheck to allow creating separate checkers for checked LogReader. There is a single TODO in LogReaderExt for one missing check. Tests run. Further optimizations of the API to yet better streamline applying log entries to the state machine (if the state machine is complex and can process requests in the background) are still pending. Further optimizations of the LogReader API to "invert" the semantics to send the functor to process the log entry to the log instead of materializing the log on heap are also pending. async_trait optimization is pending Configuration of types to use for optimizing various synchronization operations (like one-shot channel) is pending.
- Loading branch information
Showing
60 changed files
with
816 additions
and
557 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.