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

Change: refine the RaftEntry trait #1293

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

drmingdrmer
Copy link
Member

@drmingdrmer drmingdrmer commented Jan 8, 2025

Changelog

Change: refine the RaftEntry trait
  • The RaftEntry trait now requires AsRef<LogIdOf<C>> and
    AsMut<LogIdOf<C>>, providing a more standard API for accessing the
    log ID of a log entry. As a result, the RaftEntry: RaftLogId
    requirement is no longer needed.

  • A new method, new_normal(), has been added to the RaftEntry trait
    to replace the FromAppData trait.

  • Additional utility methods for working with entries are now provided
    in the RaftEntryExt trait.

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

Upgrade tips:

  1. For applications using a custom RaftEntry implementation (e.g.,
    declared with declare_raft_types!(MyTypes: Entry = MyEntry)):

    • Update the RaftEntry implementation for your custom entry type
      (MyEntry) by adding the new_normal() method.
    • Implement AsRef<LogId> and AsMut<LogId> for your custom entry
      type.
  2. For applications using the default Entry provided by OpenRaft:

    • No changes are required.

This change is Reviewable

@drmingdrmer drmingdrmer force-pushed the 183-log-id branch 3 times, most recently from dff2728 to 764ba69 Compare January 8, 2025 12:43
@drmingdrmer drmingdrmer marked this pull request as draft January 8, 2025 13:04
@drmingdrmer drmingdrmer force-pushed the 183-log-id branch 2 times, most recently from 2abaffb to 25b71e0 Compare January 8, 2025 13:22
- The `RaftEntry` trait now requires `AsRef<LogIdOf<C>>` and
  `AsMut<LogIdOf<C>>`, providing a more standard API for accessing the
  log ID of a log entry. As a result, the `RaftEntry: RaftLogId`
  requirement is no longer needed.

- A new method, `new_normal()`, has been added to the `RaftEntry` trait
  to replace the `FromAppData` trait.

- Additional utility methods for working with entries are now provided
  in the `RaftEntryExt` trait.

- Part of databendlabs#1278

Upgrade tips:

1. **For applications using a custom `RaftEntry` implementation** (e.g.,
   declared with `declare_raft_types!(MyTypes: Entry = MyEntry)`):
   - Update the `RaftEntry` implementation for your custom entry type
     (`MyEntry`) by adding the `new_normal()` method.
   - Implement `AsRef<LogId>` and `AsMut<LogId>` for your custom entry
     type.

2. **For applications using the default `Entry` provided by OpenRaft**:
   - No changes are required.
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