document_loro_windows Client SQLite table
A lifetime reading served updates with Loro. The row is committed once the reader's history is built, before the page's first update is read, and deleted when the page's save commits, so a row whose lifetime has ended was left by a process that died inside it (#3194). One row per document scope and lifetime: a second pass reading the scope at once replaces it, and each pass deletes only the row it wrote.
Declared in packages/client-sdk/src/data/sqlite/schema/documentLoroWindowSchema.ts
Columns
app_kindtext- not null
Document scope and server document.
local_idtext- not null
Document scope and server document.
lifetime_idtext- not null
The lifetime (
loroLifetime.ts) that opened it.window_idtext- not null
The window, of the lifetime's, that wrote the row.
document_idtext- not null
Document scope and server document.
update_idstext- not null
The page's unsettled updates in server order, as a JSON array: those it reads with Loro, not its known voids.
countsinteger- not null
1 when the window held one update and its lifetime had met no Loro runtime failure, so a death inside it is an attempt toward that update; 0 when a death isolates the window's updates instead.
judgetext- not null
The judge (
documentVerdictJudge) the window read with. A window left by another judge counts nothing.opened_attext- not null
When it was opened, for diagnostics.
kindtext- not null
- default 'read'
What a death inside it is charged to (
LoroWindowKind):readcounts toward the update it held alone;history, a history-verification pass, never counts toward sync update voids.
Keys and constraints
- Primary key
(app_kind, local_id, lifetime_id)
DDL
The statements the client runs to create this table and its indexes.
CREATE TABLE IF NOT EXISTS "document_loro_windows" (
"app_kind" TEXT NOT NULL,
"local_id" TEXT NOT NULL,
"lifetime_id" TEXT NOT NULL,
"window_id" TEXT NOT NULL,
"document_id" TEXT NOT NULL,
"update_ids" TEXT NOT NULL,
"counts" INTEGER NOT NULL,
"judge" TEXT NOT NULL,
"opened_at" TEXT NOT NULL,
"kind" TEXT NOT NULL DEFAULT 'read',
PRIMARY KEY ("app_kind", "local_id", "lifetime_id")
);