/** * Context Sync Manager - Handles synchronization between terminals */ import { EventEmitter } from 'events'; import { ContextStore } from './context-store'; import { WebSocketManager } from '../terminal/websocket-manager'; import { ContextQuery, SyncSubscription, ContextScope, ContextType, ConflictResolution } from './types'; /** * Sync manager configuration */ export interface SyncManagerConfig { batchSize: number; syncInterval: number; maxRetries: number; retryDelay: number; compressionThreshold: number; deltaSync: boolean; conflictResolution: ConflictResolution; heartbeatInterval: number; } /** * Context Sync Manager */ export declare class ContextSyncManager extends EventEmitter { private config; private store; private wsManager; private subscriptions; private pendingUpdates; private sequenceCounters; private syncTimers; private heartbeatTimer?; private logger; constructor(store: ContextStore, wsManager: WebSocketManager, config?: Partial); /** * Setup event handlers */ private setupEventHandlers; /** * Subscribe terminal to context updates */ subscribe(terminalId: string, query: ContextQuery): SyncSubscription; /** * Unsubscribe terminal from context updates */ unsubscribe(terminalId: string): void; /** * Send initial sync to terminal */ private sendInitialSync; /** * Handle context event from store */ private handleContextEvent; /** * Check if subscriber should be notified of event */ private shouldNotifySubscriber; /** * Queue update for terminal */ private queueUpdate; /** * Get operation from event type */ private getOperationFromEvent; /** * Start sync timer for terminal */ private startSyncTimer; /** * Sync terminal with pending updates */ private syncTerminal; /** * Handle sync message from terminal */ private handleSyncMessage; /** * Handle update from terminal */ private handleTerminalUpdate; /** * Handle sync request from terminal */ private handleSyncRequest; /** * Handle conflict report from terminal */ private handleConflictReport; /** * Handle acknowledgment from terminal */ private handleAcknowledgment; /** * Handle heartbeat from terminal */ private handleHeartbeat; /** * Handle terminal disconnect */ private handleTerminalDisconnect; /** * Send sync message to terminal */ private sendSyncMessage; /** * Check if payload should be compressed */ private shouldCompress; /** * Compress payload */ private compress; /** * Get next sequence number for terminal */ private getNextSequence; /** * Start heartbeat monitoring */ startHeartbeatMonitoring(): void; /** * Stop heartbeat monitoring */ stopHeartbeatMonitoring(): void; /** * Broadcast context update to all subscribed terminals */ broadcast(key: string, value: any, type: ContextType, scope: ContextScope): Promise; /** * Get sync statistics */ getSyncStatistics(): any; /** * Destroy sync manager */ destroy(): void; } //# sourceMappingURL=context-sync-manager.d.ts.map