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

Abstract OpenRaft Core Data Structures into Traits #1278

Open
drmingdrmer opened this issue Dec 18, 2024 · 1 comment
Open

Abstract OpenRaft Core Data Structures into Traits #1278

drmingdrmer opened this issue Dec 18, 2024 · 1 comment

Comments

@drmingdrmer
Copy link
Member

Abstract OpenRaft Core Data Structures into Traits

Goal

Abstract OpenRaft's foundational data structures into traits to provide greater flexibility, allowing users to customize implementations according to their needs.
To enable users to fully define Entry types using Protobuf, we need to remove Entry's hard dependencies on other basic types (such as LogId, Membership, etc.). This means these basic types also need to be abstracted into traits to achieve complete type customization.

Types to Abstract

Basic Types:

  • Term
  • LogId
  • LeaderId and its associated type CommittedLeaderId

Composite Types:

  • Entry
  • Membership
  • Vote

Implementation Plan

  1. Start with abstracting the most fundamental Term type into a trait
  2. Gradually complete abstraction of other basic types
  3. Finally handle composite types that depend on these basic types

Expected Benefits

  • Provides greater flexibility, allowing users to fully customize data structures
  • Better support for different serialization schemes (e.g., protobuf)
  • Maintains compatibility with existing code
Copy link

👋 Thanks for opening this issue!

Get help or engage by:

  • /help : to print help messages.
  • /assignme : to assign this issue to you.

drmingdrmer added a commit to drmingdrmer/openraft that referenced this issue Dec 24, 2024
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>`.
drmingdrmer added a commit to drmingdrmer/openraft that referenced this issue Dec 24, 2024
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>`.
drmingdrmer added a commit to drmingdrmer/openraft that referenced this issue Dec 24, 2024
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>`.
drmingdrmer added a commit to drmingdrmer/openraft that referenced this issue Dec 24, 2024
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>`.
drmingdrmer added a commit to drmingdrmer/openraft that referenced this issue Dec 24, 2024
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>`.
drmingdrmer added a commit to drmingdrmer/openraft that referenced this issue Dec 24, 2024
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>`.
drmingdrmer added a commit to drmingdrmer/openraft that referenced this issue Dec 24, 2024
This refactoring moves LogId 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:

LogId is now parameterized by `RaftTypeConfig` instead of `NodeId`

- Change `LogId<NodeId>` to `LogId<C> where C: RaftTypeConfig`, for
  example, change `LogId<u64>` to `LogId<YourTypeConfig>`.

- Change trait `RaftLogId<NID: NodeId>` to `RaftLogId<C: RaftTypeConfig>`.
drmingdrmer added a commit to drmingdrmer/openraft that referenced this issue Dec 24, 2024
This refactoring moves LogId 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:

LogId is now parameterized by `RaftTypeConfig` instead of `NodeId`

- Change `LogId<NodeId>` to `LogId<C> where C: RaftTypeConfig`, for
  example, change `LogId<u64>` to `LogId<YourTypeConfig>`.

- Change trait `RaftLogId<NID: NodeId>` to `RaftLogId<C: RaftTypeConfig>`.
drmingdrmer added a commit to drmingdrmer/openraft that referenced this issue Dec 24, 2024
This refactoring moves LeaderId 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:

LeaderId is now parameterized by `RaftTypeConfig` instead of `NodeId`

- Change `LeaderId<NodeId>` to `LeaderId<C> where C: RaftTypeConfig`, for
  example, change `LeaderId<u64>` to `LeaderId<YourTypeConfig>`.

- Change `CommittedLeaderId<NodeId>` to `CommittedLeaderId<RaftTypeConfig>`.
drmingdrmer added a commit that referenced this issue Dec 25, 2024
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: #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>`.
drmingdrmer added a commit to drmingdrmer/openraft that referenced this issue Dec 25, 2024
This refactoring moves LeaderId 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:

LeaderId is now parameterized by `RaftTypeConfig` instead of `NodeId`

- Change `LeaderId<NodeId>` to `LeaderId<C> where C: RaftTypeConfig`, for
  example, change `LeaderId<u64>` to `LeaderId<YourTypeConfig>`.

- Change `CommittedLeaderId<NodeId>` to `CommittedLeaderId<RaftTypeConfig>`.
drmingdrmer added a commit that referenced this issue Dec 25, 2024
This refactoring moves LogId from a per-NodeId type to a per-TypeConfig type,
to make it consistent with `RaftTypeConfig` usage across the codebase.

- Part of: #1278

Upgrade tip:

LogId is now parameterized by `RaftTypeConfig` instead of `NodeId`

- Change `LogId<NodeId>` to `LogId<C> where C: RaftTypeConfig`, for
  example, change `LogId<u64>` to `LogId<YourTypeConfig>`.

- Change trait `RaftLogId<NID: NodeId>` to `RaftLogId<C: RaftTypeConfig>`.
drmingdrmer added a commit to drmingdrmer/openraft that referenced this issue Dec 25, 2024
This refactoring moves LeaderId 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:

LeaderId is now parameterized by `RaftTypeConfig` instead of `NodeId`

- Change `LeaderId<NodeId>` to `LeaderId<C> where C: RaftTypeConfig`, for
  example, change `LeaderId<u64>` to `LeaderId<YourTypeConfig>`.

- Change `CommittedLeaderId<NodeId>` to `CommittedLeaderId<RaftTypeConfig>`.
drmingdrmer added a commit to drmingdrmer/openraft that referenced this issue Dec 25, 2024
This refactoring moves LeaderId 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:

LeaderId is now parameterized by `RaftTypeConfig` instead of `NodeId`

- Change `LeaderId<NodeId>` to `LeaderId<C> where C: RaftTypeConfig`, for
  example, change `LeaderId<u64>` to `LeaderId<YourTypeConfig>`.

- Change `CommittedLeaderId<NodeId>` to `CommittedLeaderId<RaftTypeConfig>`.
drmingdrmer added a commit to drmingdrmer/openraft that referenced this issue Dec 25, 2024
This refactoring moves LeaderId 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:

LeaderId is now parameterized by `RaftTypeConfig` instead of `NodeId`

- Change `LeaderId<NodeId>` to `LeaderId<C> where C: RaftTypeConfig`, for
  example, change `LeaderId<u64>` to `LeaderId<YourTypeConfig>`.

- Change `CommittedLeaderId<NodeId>` to `CommittedLeaderId<RaftTypeConfig>`.
drmingdrmer added a commit to drmingdrmer/openraft that referenced this issue Dec 25, 2024
This refactoring moves LeaderId 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:

LeaderId is now parameterized by `RaftTypeConfig` instead of `NodeId`

- Change `LeaderId<NodeId>` to `LeaderId<C> where C: RaftTypeConfig`, for
  example, change `LeaderId<u64>` to `LeaderId<YourTypeConfig>`.

- Change `CommittedLeaderId<NodeId>` to `CommittedLeaderId<RaftTypeConfig>`.
drmingdrmer added a commit that referenced this issue Dec 25, 2024
This refactoring moves LeaderId from a per-NodeId type to a per-TypeConfig type,
to make it consistent with `RaftTypeConfig` usage across the codebase.

- Part of: #1278

Upgrade tip:

LeaderId is now parameterized by `RaftTypeConfig` instead of `NodeId`

- Change `LeaderId<NodeId>` to `LeaderId<C> where C: RaftTypeConfig`, for
  example, change `LeaderId<u64>` to `LeaderId<YourTypeConfig>`.

- Change `CommittedLeaderId<NodeId>` to `CommittedLeaderId<RaftTypeConfig>`.
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

No branches or pull requests

1 participant