// ----------------------------------------------------------------------------- // IHybridLogicalClock.cs // Sprint: SPRINT_20260105_002_001_LB_hlc_core_library // Task: HLC-003 - Define HLC interface // ----------------------------------------------------------------------------- namespace StellaOps.HybridLogicalClock; /// /// Hybrid Logical Clock for monotonic timestamp generation across distributed nodes. /// /// /// HLC combines physical (wall-clock) time with logical counters to provide: /// - Monotonic timestamps even under clock skew /// - Causal ordering guarantees across distributed nodes /// - Deterministic tie-breaking for concurrent events /// public interface IHybridLogicalClock { /// /// Generate next timestamp for local event. /// /// /// This should be called for every event that needs ordering: /// - Job enqueue /// - State transitions /// - Audit log entries /// /// New monotonically increasing HLC timestamp HlcTimestamp Tick(); /// /// Update clock on receiving remote timestamp, return merged result. /// /// /// Called when receiving a message from another node to ensure /// causal ordering is maintained across the distributed system. /// /// Timestamp from remote node /// New timestamp that is greater than both local clock and remote timestamp /// If clock skew exceeds configured threshold HlcTimestamp Receive(HlcTimestamp remote); /// /// Current clock state (for persistence/recovery). /// HlcTimestamp Current { get; } /// /// Node identifier for this clock instance. /// string NodeId { get; } }