/** * HeadRegistryGossipTransport — Gossip-aware decorator for IHeadRegistry. * * Wraps any IHeadRegistry and wires it to an IGossipService so that: * 1. Outbound: after every successful setHead(), the update is announced * to peers via gossip. * 2. Inbound: incoming 'head_update' gossip announcements are merged into * the wrapped registry using last-writer-wins semantics. * 3. Anti-entropy: an optional periodic timer re-announces all known head * pointers so that nodes that missed earlier announcements can converge. * * Usage: * const transport = new HeadRegistryGossipTransport(inner, gossipService); * transport.start(30_000); // optional anti-entropy every 30 s * // … use transport as an IHeadRegistry … * await transport.stop(); * * @see Requirements 2.1, 7.1, 7.2 */ import type { IWriteProof } from '../interfaces/auth/writeProof'; import type { IGossipService } from '../interfaces/availability/gossipService'; import type { DeferredHeadUpdate, IHeadRegistry } from '../interfaces/storage/headRegistry'; import type { HeadRecord } from '../interfaces/storage/headRegistryDriver'; export declare class HeadRegistryGossipTransport implements IHeadRegistry { private readonly inner; private readonly gossip; private readonly announcementHandler; private antiEntropyTimer?; constructor(inner: IHeadRegistry, gossip: IGossipService); /** * Start the optional anti-entropy timer. * When `antiEntropyIntervalMs` is provided and > 0, the transport will * periodically re-announce all known head pointers so that peers that * joined late (or missed earlier announcements) can converge. * * @param antiEntropyIntervalMs - Interval in milliseconds between anti-entropy * passes. Pass 0 or omit to disable. */ start(antiEntropyIntervalMs?: number): void; /** * Stop the anti-entropy timer and unregister the inbound handler. * Should be called when the transport is no longer needed. */ stop(): Promise; /** * Re-announce every known head pointer via gossip. * Used by the anti-entropy timer and can also be called manually to * trigger an immediate convergence pass. */ pushSnapshot(): Promise; /** * Set the head pointer locally and announce the update to peers. * Gossip announcement is best-effort: a failure does not roll back the * local write. */ setHead(dbName: string, collectionName: string, blockId: string, writeProof?: IWriteProof): Promise; getHead(dbName: string, collectionName: string): string | undefined; removeHead(dbName: string, collectionName: string, writeProof?: IWriteProof): Promise; clear(): Promise; load(): Promise; getAllHeads(): Map; getHeadTimestamp(dbName: string, collectionName: string): Date | undefined; mergeHeadUpdate(dbName: string, collectionName: string, blockId: string, timestamp: Date, writeProof?: IWriteProof): Promise; deferHeadUpdate(dbName: string, collectionName: string, blockId: string, timestamp: Date): Promise; applyDeferredUpdates(blockId: string): Promise; getDeferredUpdates(): DeferredHeadUpdate[]; exportSnapshot(): ReadonlyMap; mergeSnapshot(snapshot: Iterable): Promise<{ merged: number; skipped: number; }>; onHeadChange(dbName: string, collectionName: string, callback: (blockId: string) => void): () => void; } //# sourceMappingURL=headRegistryGossipTransport.d.ts.map