-
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
Change: change Vote<NID:NodeId>
to Vote<C:RaftTypeConfig>
#1279
Conversation
a51c0c3
to
864bc17
Compare
This refactoring moves Vote from a per-NodeId type to a per-TypeConfig type, to make it consistent with `RaftTypeConfig` usage across the codebase. - Part of: databendlabs#1278 Upgrade tip: Vote is now parameterized by `RaftTypeConfig` instead of `NodeId` - Change `Vote<NodeId>` to `Vote<C> where C: RaftTypeConfig`, for example, change `Vote<u64>` to `Vote<YourTypeConfig>`.
864bc17
to
b6d2c7e
Compare
To address #1278, types like |
dose change |
No. There is no data format change. The only thing changed is the way to declare the data format: |
i see the new definition is pub struct Vote<C: RaftTypeConfig> {
/// The id of the node that tries to become the leader.
pub leader_id: LeaderId<C::NodeId>,
pub committed: bool,
} so there is no format change. but my question is: since the new and old definition declare id as C::NodeId, what the point introduce RaftTypeConfig param instead of NID: NodeId? |
In order to allow to define all of the data types in protobuf, such as struct Vote<NID> {
leader_id: LeaderId<_>,
// ..
} Should be updated to struct Vote<C> {
leader_id: C::LeaderId,
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 47 of 47 files at r1.
Reviewable status: all files reviewed (commit messages unreviewed), all discussions resolved (waiting on @schreter)
Changelog
Change: change
Vote<NID:NodeId>
toVote<C:RaftTypeConfig>
This refactoring moves Vote from a per-NodeId type to a per-TypeConfig type,
to make it consistent with
RaftTypeConfig
usage across the codebase.Upgrade tip:
Vote is now parameterized by
RaftTypeConfig
instead ofNodeId
Vote<NodeId>
toVote<C> where C: RaftTypeConfig
, forexample, change
Vote<u64>
toVote<YourTypeConfig>
.This change is