How lonewolf38/registry works
Main Components
a) Server Components:
• TCP Server (Main Entry Point)
• HB Protocol Parser
• Registry Service
• Cache System
• (Future) Raft Consensus Layer
b) Client Components:
• TCP Client(s)
• Heartbeat Generator
┌─ Protocol Layer ─────┐ ┌─ Service Layer ──┐ ┌─ Storage Layer ──┐
• TCP Server ─────────► │ Registry ──────► │ Cache │
• HB Protocol ◄─────────┤ Service │ │ Strategies │
• ┘ └──────────────────┘ └──────────────────┘
Component Details
• Blue rectangles for network components (TCP Server)
• Green rectangles for processing components (Protocol Parser)
• Yellow rectangles for service components (Registry)
• Purple rectangles for storage components (Cache)
Following flows:
a) Client → TCP Server (Heartbeat packets)
b) TCP Server → Protocol Parser (Raw data)
c) Protocol Parser → Registry Service (Parsed heartbeats)
d) Registry Service → Cache (Host registration data)
Key Elements to Highlight
a) Protocol Layer:
• TCP connection handling (pkg/protocol/tcp.go)
• Heartbeat protocol parsing (pkg/protocol/beat.go)
• Connection management
b) Service Layer:
• Registry service (pkg/registry/registry.go)
• Host registration logic
• Health checking mechanism
c) Storage Layer:
• Cache implementation (pkg/cache/cache.go)
• Different caching strategies (planned)
• Future Raft consensus integration points
Implementation Notes
Use these visual elements:
• State transition indicators for host registration status
Scale and Distribution
How the system will scale by including:
• Multiple client connections
• Future Raft cluster nodes
• Cache distribution possibilities
Remember to indicate the project's evolution path by marking future implementations differently from current ones, as this will help in understanding both the current state and the intended architecture.