Implement sophisticated conflict resolution and finalize cluster

Features completed:
- Sophisticated conflict resolution with majority vote system
- Oldest node tie-breaker for even cluster scenarios
- Two-phase conflict resolution (majority vote → oldest node)
- Comprehensive logging for conflict resolution decisions
- Member querying for distributed voting
- Graceful fallback to oldest node rule when no quorum available

Technical implementation:
- resolveConflict() function implementing full design specification
- resolveByOldestNode() for 2-node scenarios and tie-breaking
- queryMemberForData() for distributed consensus gathering
- Detailed logging of vote counts, winners, and decision rationale

Configuration improvements:
- Updated .gitignore for data directories and build artifacts
- Test configurations for 3-node cluster setup
- Faster sync intervals for development/testing

The KVS now fully implements the design specification:
 Hierarchical key-value storage with BadgerDB
 HTTP REST API with full CRUD operations
 Gossip protocol for membership discovery
 Eventual consistency with timestamp-based resolution
 Sophisticated conflict resolution (majority vote + oldest node)
 Gradual bootstrapping for new nodes
 Operational modes (normal, read-only, syncing)
 Structured logging with configurable levels
 YAML configuration with auto-generation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-10 07:32:16 +03:00
parent c9b430fc0d
commit e5c9dbc7d8
3 changed files with 224 additions and 2 deletions

14
config.yaml Normal file
View File

@ -0,0 +1,14 @@
node_id: GALACTICA
bind_address: 127.0.0.1
port: 8080
data_dir: ./data
seed_nodes: []
read_only: false
log_level: info
gossip_interval_min: 60
gossip_interval_max: 120
sync_interval: 300
catchup_interval: 120
bootstrap_max_age_hours: 720
throttle_delay_ms: 100
fetch_delay_ms: 50