/** * @nahisaho/yata-scale - Vector Clock * * Logical clock for causality tracking */ import type { VectorClockValue } from '../types.js'; /** * Comparison result */ export type ClockComparison = 'before' | 'after' | 'concurrent' | 'equal'; /** * Vector clock for distributed causality tracking */ export declare class VectorClock { private clock; constructor(initial?: VectorClockValue); /** * Increment clock for a node */ increment(nodeId: string): void; /** * Get clock value for a node */ get(nodeId: string): number; /** * Set clock value for a node */ set(nodeId: string, value: number): void; /** * Merge with another clock (point-wise maximum) */ merge(other: VectorClock): void; /** * Compare with another clock */ compare(other: VectorClock): ClockComparison; /** * Check if this clock happened before another */ happenedBefore(other: VectorClock): boolean; /** * Check if this clock happened after another */ happenedAfter(other: VectorClock): boolean; /** * Check if concurrent with another clock */ isConcurrentWith(other: VectorClock): boolean; /** * Check if equal to another clock */ isEqual(other: VectorClock): boolean; /** * Clone this clock */ clone(): VectorClock; /** * Convert to plain object */ toValue(): VectorClockValue; /** * Create from plain object */ static fromValue(value: VectorClockValue): VectorClock; /** * Serialize to string */ serialize(): string; /** * Deserialize from string */ static deserialize(data: string): VectorClock; /** * Get all node IDs */ getNodes(): string[]; /** * Get number of nodes */ get size(): number; /** * Check if empty */ get isEmpty(): boolean; /** * Get maximum timestamp across all nodes */ getMaxTimestamp(): number; /** * Get sum of all timestamps */ getSum(): number; /** * Clear the clock */ clear(): void; /** * String representation */ toString(): string; } //# sourceMappingURL=VectorClock.d.ts.map