/** * Distributed Indexing - Multi-node synchronization and replication * * Extends local indexing with distributed capabilities: * - Index replication across peers * - Vector clock-based consistency tracking * - Conflict detection and resolution * - Synchronization protocols */ export interface IndexVectorClock { clock: Record; } export interface IndexReplicationState { indexName: string; localVersion: IndexVectorClock; peerVersions: Record; replicatedPeers: Set; pendingSync: IndexOperation[]; } export type IndexOperation = { type: 'create_index'; name: string; field: string; indexType: string; } | { type: 'update_index'; name: string; recordId: string; value: string; } | { type: 'delete_index'; name: string; }; export interface IndexSyncMessage { sourcePeer: string; targetPeer: string; indexName: string; version: IndexVectorClock; operations: IndexOperation[]; timestamp: number; } export interface RemoteIndexMetadata { name: string; version: IndexVectorClock; entryCount: number; avgQueryTimeMs: number; lastUpdated: number; } export interface RemoteIndexState { peerId: string; indexes: Record; lastSync: number; reachable: boolean; } export type ConsistencyLevel = 'local' | 'eventual' | 'causal' | 'strong'; export interface ReplicationStatus { indexName: string; replicatedTo: number; totalPeers: number; reachablePeers: number; pendingSyncs: number; consistencyLevel: ConsistencyLevel; } export interface VersionConflict { indexName: string; localVersion: IndexVectorClock; remotePeer: string; remoteVersion: IndexVectorClock; } export interface DistributedSyncStatus { totalIndexes: number; fullyReplicated: number; partiallyReplicated: number; pendingOperations: number; unreachablePeers: number; } /** * Distributed Index Manager - TypeScript implementation */ export declare class DistributedIndexManager { private localPeerId; private replicationStates; private peerStates; private pendingOperations; constructor(localPeerId: string); /** * Create a replicated index */ createReplicatedIndex(name: string, field: string, indexType: string): void; /** * Register a peer for replication */ registerPeer(peerId: string): void; /** * Update remote peer's index metadata */ updatePeerIndexMetadata(peerId: string, indexName: string, metadata: RemoteIndexMetadata): void; /** * Enqueue a sync message */ enqueueSyncMessage(message: IndexSyncMessage): void; /** * Get pending sync messages for a peer */ getPendingForPeer(peerId: string): IndexSyncMessage[]; /** * Acknowledge sync from peer */ acknowledgePeerSync(peerId: string, indexName: string): void; /** * Get replication status for an index */ getReplicationStatus(indexName: string): ReplicationStatus | null; /** * Calculate consistency level for an index */ private calculateConsistencyLevel; /** * Get replication targets for an index */ getReplicationTargets(indexName: string): string[]; /** * Detect version conflicts */ detectConflicts(indexName: string): VersionConflict[]; /** * Merge versions using CRDT strategy */ mergeVersions(indexName: string): void; /** * Set peer reachability */ setPeerReachable(peerId: string, reachable: boolean): void; /** * Get overall sync status */ getSyncStatus(): DistributedSyncStatus; /** * Vector clock utilities */ private isConcurrent; private happensBefore; private mergeClocks; } /** * Synchronization coordinator for multi-node environments */ export declare class DistributedSyncCoordinator { private indexManager; private syncInterval; private syncIntervalMs; constructor(indexManager: DistributedIndexManager); /** * Start periodic synchronization */ startSync(intervalMs?: number): void; /** * Stop synchronization */ stopSync(): void; /** * Perform synchronization cycle */ private performSync; /** * Explicitly sync a specific index */ syncIndex(indexName: string): void; } //# sourceMappingURL=distributed-indexing.d.ts.map