-
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.
Change: remove
N, LS, SM
from Raft<C, N, LS, SM>
- `Raft<C, ..>`: is a control handle of `RaftCore` and it does not directly rely on `N: RaftNetworkFactory`, `LS: RaftLogStorage` and `SM: RaftStateMachine`. Thus these types should not be part of `Raft`. In this commit, we remove `N, LS, SM` from `Raft<C, N, LS, SM>`, `RaftInner<C, N, LS>` and `RaftMsg<C, N, LS>`. Type `N, LS, SM` now are only used by `Raft::new()` which needs these types to create `RaftCore`. - `Raft::external_request()`: Another change is the signature of the `Fn` passed to `Raft::external_request()` changes from `FnOnce(&RaftState, &mut LS, &mut N)` to `FnOnce(&RaftState)`. - Fix: the `FnOnce` passed to `Raft::external_request()` should always be `Send`, unoptionally. Because it is used to send from `Raft` to `RaftCore`. - Fix: #939
- Loading branch information
1 parent
4ad89fe
commit 87c0d74
Showing
18 changed files
with
99 additions
and
146 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//! Defines API for application to send request to access Raft core. | ||
|
||
use crate::type_config::alias::InstantOf; | ||
use crate::type_config::alias::NodeIdOf; | ||
use crate::type_config::alias::NodeOf; | ||
use crate::RaftState; | ||
|
||
/// Boxed trait object for external request function run in `RaftCore` task. | ||
pub(crate) type BoxCoreFn<C> = Box<dyn FnOnce(&RaftState<NodeIdOf<C>, NodeOf<C>, InstantOf<C>>) + Send + 'static>; |
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.