ecchronos icon indicating copy to clipboard operation
ecchronos copied to clipboard

Create ReplicationState and ReplicationStateImpl Class for Managing Token-to-Replicas Mapping

Open VictorCavichioli opened this issue 5 months ago • 0 comments

Story Description: A new class, ReplicationStateImpl, will be created to generate and manage token-to-replicas mappings for a specific table within a Cassandra cluster. This class will implement the ReplicationState interface and provide methods for retrieving node replicas based on token ranges, and for managing replication state both within a keyspace and across the entire cluster.

Key Responsibilities:

  1. Token-to-Replicas Mapping: Generate and manage mappings of token ranges to replicas for a given keyspace and table.
  2. Caching: Utilize caching to improve performance by storing token-to-replicas mappings in memory.
  3. Metadata Handling: Retrieve and process metadata from the Cassandra session to build accurate token-to-replicas mappings.
  4. Cluster-Wide vs. Keyspace-Wide Replication: Support both keyspace-specific and cluster-wide replication scenarios.

Acceptance Criteria:

  1. Ensure proper handling of Cassandra metadata and token maps to build accurate token-to-replicas mappings.
  2. Handle cases where metadata or token maps are not present.
  3. Provide unit tests to validate the correctness of the class's functionality, including token-to-replicas mapping generation and cache management.
  4. Verify integration with the Cassandra session and node resolver.
  5. Document the class and its methods, including parameters and return values.

Definition of Done:

  1. The ReplicationStateImpl class is implemented and integrated into the project.
  2. The class provides correct and efficient management of token-to-replicas mappings.
  3. Caching and metadata handling are functioning as expected.
  4. Unit tests are written and pass successfully.
  5. The code is reviewed, and any issues are addressed.
  6. The project builds successfully, and all relevant tests pass.

Notes:

Depends of #718 Related to #652

VictorCavichioli avatar Sep 19 '24 19:09 VictorCavichioli