-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RaftMsg::ExternalRequest: should not rely on RaftLogStorage and RaftNetworkFactory #939
Comments
👋 Thanks for opening this issue! Get help or engage by:
|
Thanks, as discussed on Discord, fine for me. BTW, unless there are other users who feel otherwise, feel free to reduce the parameters to only |
|
- `Raft<C, ..>`: is a control handle of `RaftCore` and it does not directly rely on `N: RaftNetworkFactory` and `LS: RaftLogStorage`. Thus these two type should not be part of `Raft`. In this commit, we remove `N, LS` from `Raft<C, N, LS, SM>`, `RaftInner<C, N, LS>` and `RaftMsg<C, N, LS>`. Type `N, LS` now is only used by `Raft::new()` which needs these two 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: databendlabs#939
- `Raft<C, ..>`: is a control handle of `RaftCore` and it does not directly rely on `N: RaftNetworkFactory` and `LS: RaftLogStorage`. Thus these two type should not be part of `Raft`. In this commit, we remove `N, LS` from `Raft<C, N, LS, SM>`, `RaftInner<C, N, LS>` and `RaftMsg<C, N, LS>`. Type `N, LS` now is only used by `Raft::new()` which needs these two 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: databendlabs#939
- `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: databendlabs#939
- `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
ExternalRequest
passes the implementation ofRaftLogStore
andRaftNetworkFactory
to a user definedfn
. This adds unnecessarydependency(
N, LS
) toRaftMsg
,RaftInner
andRaft
.Update: 2023-11-20:
These types should be erased by replacing them with
&dny RaftLogStore
and&dyn RaftNetworkFactory
.Just remove
LS
andN
from ExternalRequest.Because
RaftLogStorage
will be moved out ofRaftCore
task, it's impossible to access&RaftState
and&LS
at the same time.The text was updated successfully, but these errors were encountered: