Skip to content

Abstract OpenRaft Core Data Structures into Traits #1278

@drmingdrmer

Description

@drmingdrmer

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 LogId will not be abstracted in this version for simplicity. It is primarily used internally and is not a critical component for applications, so it can remain as is.
  • LeaderId and its associated type CommittedLeaderId

Composite Types:

  • Entry
  • Membership Membership will not be abstracted as it is not on the hot path and can be reconstructed as needed.
  • 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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions