Skip to content
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

Feature: Abstract Vote #1292

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

drmingdrmer
Copy link
Member

@drmingdrmer drmingdrmer commented Jan 3, 2025

Changelog

Feature: Abstract Vote

  • Added an associated type Vote: RaftVote to RaftTypeConfig,
    allowing applications to customize the Vote implementation.

  • Introduced the OrdBy trait with the method fn ord_by() -> Option<Ordering> to enable customized ordering for types.
    This trait is used internally only for determine RaftVote order.

    The ordering logic is consistent across different Vote
    implementations and does not require the application to implement
    PartialOrd directly for Vote. Instead, this ordering property is
    provided by OpenRaft.

  • Implemented RaftVote for the struct Vote, which serves as the
    default RaftVote implementation. This ensures that applications
    upgrading OpenRaft do not need to make any changes.

  • Part of Abstract OpenRaft Core Data Structures into Traits #1278


This change is Reviewable

- Added an associated type `Vote: RaftVote` to `RaftTypeConfig`,
  allowing applications to customize the `Vote` implementation.

- Introduced the `OrdBy` trait with the method `fn ord_by() ->
  Option<Ordering>` to enable customized ordering for types.
  This trait is used internally only for determine `RaftVote` order.

  The ordering logic is consistent across different `Vote`
  implementations and does not require the application to implement
  `PartialOrd` directly for `Vote`. Instead, this ordering property is
  provided by OpenRaft.

- Implemented `RaftVote` for the struct `Vote`, which serves as the
  default `RaftVote` implementation. This ensures that applications
  upgrading OpenRaft do not need to make any changes.

- Part of databendlabs#1278
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant