UNPKG

@tanstack/db

Version:

A reactive client store for building super fast apps on sync

49 lines (48 loc) • 1.73 kB
import { BucketFacadeCompilation } from "./materialized-pipeline.cjs"; export type FacadePublication = { prepare: () => void; publish: () => void; rollback: () => void; }; /** * The only stateful boundary outside the materialization graph. It turns inert * bucket references into stable public Collection facades and applies the * graph's canonical bucket-row deltas to those facades. */ export declare class BucketFacadeAdapter { private readonly parentId; private readonly compilations; private pending; private pendingActivity; private readonly activeBuckets; private readonly entries; private readonly retiredEntries; private resolvedValues; private cleanedUp; constructor(parentId: string, compilations: Array<BucketFacadeCompilation>, onMessages: (count: number) => void); hasPendingChanges(): boolean; flush(): FacadePublication; resolve<T>(value: T): T; cleanup(): void; private accumulate; private copyRows; private snapshot; /** Restore the facades, then discard their events even if restore throws. */ private abort; private restore; private accumulateActivity; private getActiveBuckets; /** * Begin a facade write. Copy the facade's rows and defer its events before * its first write in the flush, so a rollback reads only the facades the * flush wrote. A bucket written and then retired in one flush copies once. */ private beginWrite; private retireEntry; private getEntry; private applyChange; /** Resolve and validate every public key before opening a sync transaction. */ private prepareChange; private resolveValue; private cleanupRetiredEntries; }