Expand description
Restore a layout another build saved.
Every channel and every version keeps its own objects.db
(channels/<ch>/versions/<v>/data/db/), and with it its own session record
(session_restore, Client.meta["session:last_topology"]). So a build
that has never run here, or a different local build, comes up with the
default layout while the record the previous build saved sits unused in
that buildโs database. This finds those records, reading each database
read-only, and rebuilds one in this instance with the replay a same-build
restore uses (session_restore::replay_tabs). The other database is never
written.
A first launch, or a cold start that seeds the default layout because
nothing was restored, remembers it (remember_seeded_default); while
that layout is untouched the window offers the newest record, and
restoring replaces it.
Structsยง
- DbFile ๐
- Scan
Roots ๐ - Where to look: the channels root, and this processโs own
data/db/(never offered).
Constantsยง
- BUSY_
TIMEOUT ๐ - A database another process holds locked is skipped after this long rather than waited for.
- DEFAULT_
VIEWS ๐ - The views of the default seed (
window_create): a record holding only these, with no agent chosen, is not worth offering. - MAX_
SCANNED ๐ - Databases opened per scan, the most recently written first: each is one open and one row read, and only recent builds matter.
- SCAN_
BUDGET ๐ - A scan stops opening databases after this long.
- SEEDED_
META_ ๐KEY - The default layout a cold start seeded:
{workspace_id, tab_id, block_ids}.
Functionsยง
- apply_
publish ๐ - db_
files ๐ - Every
channels/<ch>/versions/<v>/data/db/objects.dbbut this processโs own. Dev builds keep theirs underdev/, outside the channels root. - discover ๐
- The layouts other builds saved, newest first. Reads at most
MAX_SCANNEDdatabases, the most recently written first, for at mostbudget; one that is missing, locked, corrupt or of an unknown shape is skipped. Blocking: run it off the async workers. - immutable_
uri ๐ pathas an SQLite URI withimmutable=1.- is_
plain_ ๐segment - A single, plain path segment: what a channel or version directory is named.
- locate ๐
- The database of build
channel/version, never this processโs own. - meta_
str ๐ - modified_
ms ๐ - newest_
other_ ๐version_ db - The most recently written database of another version of this processโs
own channel: the version a new one follows (
user_workspaceโs upgrade copy, SPEC_WORKSPACES_2026_10_23.md ยง4.2).Noneoutside a channel. - open_
other_ ๐db - Another buildโs database at
path, read-only. A database with nothing in its-walis opened immutable, so not even the readerโs-wal/-shmfiles are created; one with WAL content is opened as an ordinary reader, which reads that content and may add the-shmindex. - own_
channel ๐ - The channel this processโs own database belongs to: the
<ch>of<channels root>/<ch>/versions/<v>/data/db.Nonefor a database elsewhere (a dev buildโs, underdev/). - read_
record ๐ - The session record in the database at
path, read-only (open_other_db). - remember_
first_ ๐launch_ default - A first launch: the store was empty and
wcore::ensure_initial_dataseeded the default layout, which a new build or a new local build starts with. - remember_
seeded_ ๐default - A cold start seeded the default layout because nothing was restored.
- restore ๐
- Rebuild the layout build
channel/versionsaved into windowwindow_id: its first windowโs tabs into this window, replacing the default tab when it is untouched and otherwise beside what is open; its other windows each into a workspace of its own, queued for this window to open (window.TakeRestoredWindows). - same_
dir ๐ - srv_
running ๐ - Whether an srv is running on the database
db(<data>/db/objects.db): thesrv.lockbesidedb/names a pid that is still an srv that wrote it. Restoring that buildโs layout here would run its agents twice. - summarize ๐
- Describe a record, or
Nonewhen it holds nothing worth restoring: no tabs, or only the untouched default layout.written_msstands in for the save time a record made before records carried one. - untouched_
default_ ๐tab - The seeded default tab of workspace
ws_id, if the workspace still holds only it, with the same panes and no agent chosen in its agent pane. - wal_len ๐
- wal_of ๐