import type { RawCoID } from "./ids.js"; import type { PeerID } from "./sync.js"; import type { StorageAPI } from "./storage/types.js"; /** * Set the delay for flushing pending sync state updates to storage. * @internal */ export declare function setSyncStateTrackingBatchDelay(delay: number): void; /** * Tracks CoValues that have unsynced changes to specific peers. * Maintains an in-memory map and periodically persists to storage. */ export declare class UnsyncedCoValuesTracker { private unsynced; private coValueListeners; private globalListeners; private pendingUpdates; private flushTimer; private storage?; /** * Add a CoValue as unsynced to a specific peer. * Triggers persistence if storage is available. * @returns true if the CoValue was already tracked, false otherwise. */ add(id: RawCoID, peerId?: PeerID): boolean; /** * Remove a CoValue from being unsynced to a specific peer. * Triggers persistence if storage is available. */ remove(id: RawCoID, peerId?: PeerID): void; /** * Remove all tracking for a CoValue (all peers). * Triggers persistence if storage is available. */ removeAll(id: RawCoID): void; forcePersist(): Promise | undefined; private schedulePersist; /** * Flush all pending persistence updates in a batch */ private flush; /** * Get all CoValue IDs that have at least one unsynced peer. */ getAll(): RawCoID[]; /** * Check if all CoValues are synced */ isAllSynced(): boolean; /** * Check if a specific CoValue is tracked as unsynced. */ has(id: RawCoID): boolean; /** * Subscribe to changes in whether a specific CoValue is synced. * The listener is called immediately with the current state. * @returns Unsubscribe function */ subscribe(id: RawCoID, listener: (synced: boolean) => void): () => void; /** * Subscribe to changes in whether all CoValues are synced. * The listener is called immediately with the current state. * @returns Unsubscribe function */ subscribe(listener: (synced: boolean) => void): () => void; setStorage(storage: StorageAPI): void; removeStorage(): void; /** * Notify all listeners for a specific CoValue about sync status change. */ private notifyCoValueListeners; /** * Notify all global listeners about "all synced" status change. */ private notifyGlobalListeners; /** * Keep only the last update for each (id, peerId) combination */ private simplifyPendingUpdates; } //# sourceMappingURL=UnsyncedCoValuesTracker.d.ts.map