> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bijection.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Datasets on branches

A world (a branch of your installation) sees its own copy of a synced dataset
without copying data: an Iceberg branch ref `w/<world>` in the same table.

## Fork a synced dataset

An operator calls `transfers.lake.attach({ sync, world, at, until, consumer,
principal })` for the world: `at` is the version the branch overlays, `until`
the instant it ends, and `principal` the writer's export principal. Transfer
checks the branch's generation, fork basis and end, then submits to the
Datasets installation's `forking` target.

Versions are sealed tokens that code compares only for equality, so Transfer
decides that the served head is at or before `at` by its own sequence of the
revisions it served. `at` must be one of them, or the attach is refused
`BranchBasis`. Ask `transfers.lake.basis({ sync })` for the latest, open the
world from it (`ctx.branch({ from })`), and attach with that `at`. The ref `w/<world>` is created at
main's last confirmed head, zero copy, and held until `until` (at most a year).
The world's own consumer continues the feed after that head, so the branch's
ranges are its own ordinals and versions, current on that ref. The same writer
loop serves it.

Holds, reach records and the erase counter are shared with `main`: an erasure
on the dataset reaches the branch's versions too.

## End a branch

At the world's `until`, the Datasets installation ends the branch and removes
the ref; submit to `lake.ending` with `{ dataset, ref }` to end it earlier. The
branch's versions stay readable while held, then retire like any other.

A restore of the installation starts a new generation of each sync
(`lake.syncs.restart`), which backfills and switches `main` only when complete.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.