ecchronos
ecchronos copied to clipboard
Create ReplicationState and ReplicationStateImpl Class for Managing Token-to-Replicas Mapping
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:
- Token-to-Replicas Mapping: Generate and manage mappings of token ranges to replicas for a given keyspace and table.
- Caching: Utilize caching to improve performance by storing token-to-replicas mappings in memory.
- Metadata Handling: Retrieve and process metadata from the Cassandra session to build accurate token-to-replicas mappings.
- Cluster-Wide vs. Keyspace-Wide Replication: Support both keyspace-specific and cluster-wide replication scenarios.
Acceptance Criteria:
- Ensure proper handling of Cassandra metadata and token maps to build accurate token-to-replicas mappings.
- Handle cases where metadata or token maps are not present.
- Provide unit tests to validate the correctness of the class's functionality, including token-to-replicas mapping generation and cache management.
- Verify integration with the Cassandra session and node resolver.
- Document the class and its methods, including parameters and return values.
Definition of Done:
- The ReplicationStateImpl class is implemented and integrated into the project.
- The class provides correct and efficient management of token-to-replicas mappings.
- Caching and metadata handling are functioning as expected.
- Unit tests are written and pass successfully.
- The code is reviewed, and any issues are addressed.
- The project builds successfully, and all relevant tests pass.
Notes:
Depends of #718 Related to #652