import { CID } from 'multiformats/cid'; import type { Applog } from '../applog/datom-types.ts'; import type { WriteableThread } from '../thread/writeable.ts'; import type { BlockStore } from '../blockstore/index.ts'; /** * Block retrieval abstraction - fetch or get blocks. * Implemented by gateway retriever or local blockstore. */ export interface BlockRetriever { /** Get single block by CID */ get(cid: CID): Promise; /** Get all blocks in DAG rooted at CID (for applogs/info sub-DAGs) */ getDag(cid: CID): AsyncIterable<{ cid: CID; bytes: Uint8Array; }>; } /** * Wrap a BlockRetriever so fetched blocks flow through a BlockStore. * - get: delegates to store.get() (which handles local-first / remote fallback) * - getDag: streams from source, puts each block into store */ export declare function withBlockCache(source: BlockRetriever, store: BlockStore): BlockRetriever; /** * Options for updateThreadFromSnapshot */ export interface UpdateOptions { /** CID of last included snapshot - exclude this and older snapshots */ excludeSnapshotCID?: CID; /** Stop when we reach this counter (walking backwards) */ stopAtCounter?: number; /** Maximum number of snapshots to traverse (default: 100) */ maxDepth?: number; } /** * Result from updateThreadFromSnapshot */ export interface UpdateResult { /** Root CID that was fetched */ cid: CID; /** All applogs decoded from the chain */ applogs: Applog[]; /** Count of applogs actually inserted (not duplicates) */ insertedCount: number; /** Number of snapshots traversed */ snapshotCount: number; /** Counter range encountered (min/max) */ counterRange?: { minCounter: number; maxCounter: number; }; } /** * Fetch snapshot chain from CID using a BlockRetriever, decode applogs, insert into thread. * Stops before excludeSnapshotCID if provided (incremental update). * * @param thread - WriteableThread to insert applogs into * @param cid - Root CID of the snapshot to start from * @param retriever - BlockRetriever for fetching blocks * @param options - Optional configuration * @returns UpdateResult with applogs and counts */ export declare function updateThreadFromSnapshot(thread: WriteableThread, cid: CID, retriever: BlockRetriever, options?: UpdateOptions): Promise; //# sourceMappingURL=update-thread.d.ts.map