forked from databendlabs/openraft
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor: Introduce
RefLogId
as a reference to a log ID
Existing `LogIdOf<C>` provides a minimal storage implementation for a log ID with essential properties. In contrast, `RefLogId` offers the same information as `LogIdOf<C>` while adding additional system-defined properties. For example, in the future, `LogIdOf<C>` defined by the application will not need to implement `Ord`. However, `RefLogId`, used internally, will provide a system-defined `Ord` implementation. This change updates internal components to return `RefLogId` or accept it as an argument where possible, enabling more flexibility and consistency in handling log IDs. 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 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. empty: try to remove log id from RaftTypeConfig
- Loading branch information
1 parent
c6a0174
commit 182db79
Showing
72 changed files
with
992 additions
and
458 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
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.