Skip to content

Use InfoPatterns enum for ReplicaTopologyProvider pattern management #3264

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ori0o0p
Copy link
Contributor

@ori0o0p ori0o0p commented Apr 18, 2025

Description

This PR refactors the ReplicaTopologyProvider class to improve pattern management by introducing an InfoPatterns enum. The enum groups related regular expression patterns previously defined as individual static final Pattern constants, enhancing code organization, type safety, and readability. The change is backward-compatible with no functional impact.

Key changes:

  • Replaced individual static Pattern constants with InfoPatterns enum to group related patterns.
  • Updated getNested method to accept InfoPatterns for improved type safety and readability.
  • Added Javadoc for InfoPatterns enum and related methods to clarify usage.
  • Improved error messages in getCurrentNodeDescription and getNested for better debugging.
  • No functional changes; maintains backward compatibility.

Checklist

  • I have read the contribution guidelines.
  • I have created a feature request first to discuss my contribution intent. See #.
  • I applied code formatting rules using the mvn formatter:format target. No formatting-related changes were submitted.
  • I have submitted test cases (unit or integration tests) to back my changes.

Additional Notes

  • Testing: Existing tests for ReplicaTopologyProvider pass without modification, as the change is purely structural. Additional unit tests were added to verify that InfoPatterns correctly compiles and matches patterns for various INFO REPLICATION outputs.
  • Documentation: Javadoc was added to the InfoPatterns enum and related methods to improve maintainability and guide future contributors.
  • Impact: This change is internal to ReplicaTopologyProvider and does not affect the public API or user-facing behavior.

Related Issue

Closes #3263


ori0o0p added 2 commits April 18, 2025 10:18
- Replaced individual static Pattern constants with InfoPatterns enum to group related patterns.
- Updated getNested method to accept InfoPatterns for improved type safety and readability.
- Added Javadoc for InfoPatterns enum and related methods to clarify usage.
- Improved error messages in getCurrentNodeDescription and getNested for better debugging.
- No functional changes; maintains backward compatibility.
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

Successfully merging this pull request may close these issues.

Improve Pattern Management in ReplicaTopologyProvider with InfoPatterns Enum
1 participant