Skip to main content
A sync keeps a dataset continuously equal to one table of your app. The table’s facts leave only through its feed. A writer (the cell’s Lake Writer, or your own engine) reads the feed, writes files and stages snapshots, and the Datasets installation commits each one.

Publish a table

Declare the sync with tableSync from @bijectionhq/library-transfer, naming the table and the dataset it is kept in. The transfer({...}) subtree is placed in your tree beside the Datasets installation:
bijection/app.ts
Then an operator attaches it once: transfers.lake.attach({ sync: "orders" }) creates the dataset in into.catalog if absent and declares the sync to the Datasets installation. Register the writer as the feed’s consumer with transfers.feeds.register({ sync, consumer, principal, authorization: "principal" }), where principal is the writer’s complete service: principal ID. Grant that principal the exporter role. An erasable table needs erasure: "release" on its tableSync before its facts may leave to a destination outside Bijection. A group of up to sixteen tables (tableSync({ tables: { a, b }, shape, into })) is kept table by table, each in its own dataset, committed together at one version.

Mirror or change log

  • shape: "mirror" keeps the table’s current state: each page collapses to every fact’s last change.
  • shape: "log" keeps every change, insert-only.
Schema changes and erasures travel in band. A change of shape starts a new generation of the sync.

How a table becomes a dataset

The writer loops:
  1. transfers.feeds.page({ sync, consumer, ack }) reads the next page.
  2. transfers.lake.next({ sync, consumer }) answers what to stage: the generation, ordinal, parent snapshot, target ref and the exact snapshot summary to write.
  3. The writer writes the files and adds the snapshot with that summary, moving no ref.
  4. transfers.lake.stage asks the Datasets installation to commit it (a task of its staging target). The writer reads transfers.lake.committed and acknowledges the page only on published; it stages again on restage or failed, and starts a new generation (ack: 0) on reset.
Each commit asserts the ref is at the previous ordinal’s snapshot and is confirmed only from the catalog’s metadata, so a resent commit is never applied twice and the feed never skips a page. Ingest, compaction, erasure rewrites and snapshot expiry are ordinals of one writer sequence per generation and never race. A new generation (a restore, a reset, a moved table) backfills into a seed ref and switches main only when the backfill is complete, so readers never see a partial table. A confirmed range is a snapshot on main. The head is tagged as a version at the sync’s publication cadence (hourly by default) or when you submit to lake.pinning with { dataset, ref: null }; a default read leases the head directly.

Check that it has caught up

freshness is "1m" (default), "15m" or "1h"; the writer pages at half of it. lake.syncs.get({ dataset, ref: null }) answers the generation, confirmed ordinal, head, cursor, lag (the age of the oldest change no ordinal carries) and stale (lag above the bound). transfers.feeds.status shows the consumer’s side. The feed keeps seven days of history by default; a consumer idle longer starts again from a new snapshot.

Query it from your engine

Open a read lease and pass it to your engine, or publish a view.

Adopt a snapshot a partner wrote

A partner or engine that lands a whole snapshot in the managed catalog has it adopted as the next version with the transfer library’s datasetLoad, through the dataset’s admit gate. Use it for datasets that are not synced.