Tearleads

document_listing_revalidations Client SQLite table

Records of ordinary documents that a container listing showed moved past what the record last read, and that still owe a read. A document whose lane covers it is not probed when its store opens or its socket reconnects, so this row is what recovers an edit or an access change whose hint was lost. It is written before the lane watermark advances past the listed row, so a restart before the read still owes it.

Declared in packages/client-sdk/src/data/sqlite/schema/documentListingRevalidationSchema.ts

Description

A debt belongs to one record, not to the document: after an identity recovery or a relink two records can name one server document, and each keeps its own cursor and key bundle. A store reads and settles only its own record's debt.

Columns

  • local_idtext
    • primary key
    • not null

    The record that owes the read.

  • document_idtext
    • not null

    The server document the listing named; a record that now names another document no longer owes it.

  • advertised_update_countinteger
    • not null

    The most updates a listing counted for it; a read settles the request only once the record's processed cursor covers them.

  • advertised_access_epochinteger
    • not null

    The epoch of the newest access head a listing showed. Each head of a document has its own epoch, and a head move raises it, so a read settles the request only once the manifest the record's last pull saved is at that epoch or a later one.

  • revisiontext
    • not null

    Replaced when the debt points to another document or raises its advertised count or access epoch, and kept when a request repeats an unchanged or lower debt for the same document, so an in-flight read can still settle a repeated debt while newer debts stay protected.

  • requested_attext
    • not null

    When this device last recorded the request.

DDL

The statements the client runs to create this table and its indexes.

CREATE TABLE IF NOT EXISTS "document_listing_revalidations" (
  "local_id" TEXT NOT NULL PRIMARY KEY,
  "document_id" TEXT NOT NULL,
  "advertised_update_count" INTEGER NOT NULL,
  "advertised_access_epoch" INTEGER NOT NULL,
  "revision" TEXT NOT NULL,
  "requested_at" TEXT NOT NULL
);