- Core API Reference
- Collection
- createCollection
- liveQueryCollectionOptions
- createLiveQueryCollection
- createOptimisticAction
- createTransaction
- Electric DB Collection
- electricCollectionOptions
- Query DB Collection
- queryCollectionOptions
- RxDB DB Collection
- rxdbCollectionOptions
- PowerSync Collection
- powerSyncCollectionOptions
- createIndexedDB
- indexedDBCollectionOptions
- React Hooks
- useLiveQuery
SyncPersistenceCapabilityV1
type SyncPersistenceCapabilityV1<TKey> = object;Defined in: packages/db/src/types.ts:602
Internal
Unstable cross-package protocol for persistence-aware adapters.
Type Parameters#
TKey#
TKey extends string | number = string | number
Properties#
hydrateBaseline()#
readonly hydrateBaseline: () => Promise<void>;Defined in: packages/db/src/types.ts:611
Returns#
Promise<void>
managedCacheGeneration?#
readonly optional managedCacheGeneration: boolean;Defined in: packages/db/src/types.ts:608
This run owns a claimed on-demand cache generation.
protocol#
readonly protocol: "@tanstack/db/sync-persistence";Defined in: packages/db/src/types.ts:605
reserveCommitTurn()#
readonly reserveCommitTurn: () => void;Defined in: packages/db/src/types.ts:634
Reserve the open sync transaction's FIFO turn. Every persisted hydration that would start before it commits waits for that commit: a subset load, a reload or reset from a peer notice, and sequence-gap recovery. A subset load admitted while the turn is reserved also runs after the commit's durable write. The source must end the transaction: commit it, or abandon it by committing with an aborted signal. An abandon releases the waiting hydrations as a commit does, so they run. A peer reset abandons a reserved transaction that began before the reset: its commit rejects with SyncTransactionAbortedError, and the reset does not wait. Sequence-gap recovery counts as a hydration only from the point where it changes rows. A source that stops for good abandons it, or every later hydration keeps waiting. The source must not await a hydrateBaseline that it started before reserving while the reservation is open: that baseline waits for the commit. Calling hydrateBaseline while the reservation is open rejects.
Returns#
void
resumeSnapshot#
readonly resumeSnapshot: object;Defined in: packages/db/src/types.ts:638
certify()#
readonly certify: () => Promise<void>;Returns#
Promise<void>
expectCurrentCommit()#
readonly expectCurrentCommit: () => void;Returns#
void
expectSourceProgress()?#
readonly optional expectSourceProgress: (progress) => void;Atomically compare the durable source token with this transaction's predecessor. The source stages its next opaque string token in collection metadata at key. A discontinuity invalidates source progress evidence until an authoritative truncate; rows and receipts still apply normally. Re-delivering the same complete source position must be idempotent; it preserves existing evidence, including an earlier incompatibility. Only adapters that implement the durable comparison expose this method.
Parameters#
progress#
key#
string
previous#
string | undefined
Returns#
void
getKeySetEvidence()#
readonly getKeySetEvidence: () =>
| SyncPersistenceKeySetEvidence
| undefined;Returns#
| SyncPersistenceKeySetEvidence | undefined
getSourceProgressCompatible()?#
readonly optional getSourceProgressCompatible: () => boolean | undefined;Source progress evidence from the atomic persisted resume snapshot.
Returns#
boolean | undefined
scanPersistedRows()#
readonly scanPersistedRows: (options?) => Promise<SyncPersistenceScannedRow<TKey>[]>;Defined in: packages/db/src/types.ts:635
Parameters#
options?#
Returns#
Promise<SyncPersistenceScannedRow<TKey>[]>
startScopedRecovery()?#
readonly optional startScopedRecovery: (resetMetadata?) => Promise<void>;Defined in: packages/db/src/types.ts:613
Retire untrusted on-demand rows and retain the provider's reset metadata.
Parameters#
resetMetadata?#
key#
string
value#
unknown
Returns#
Promise<void>
startupCacheGenerationRotated?#
readonly optional startupCacheGenerationRotated: boolean;Defined in: packages/db/src/types.ts:610
The on-demand cache generation rotated before the source sync run entered.
version#
readonly version: 1;Defined in: packages/db/src/types.ts:606