Tearleads

document_discovery_heads Client SQLite table

Only the verified signed head writes this cache, never listing fields.

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

Columns

  • document_idtext
    • not null

    Document whose verified signed head is cached.

  • organization_idtext
    • not null

    Organization the verified head names for the document.

  • manifest_hashtext
    • not null

    Access-manifest hash of the verified head. The row is reused only while it and accessEpoch match the document's pinned access-manifest checkpoint.

  • access_epochinteger
    • not null

    Access epoch of the verified head. A later write never lowers it.

Keys and constraints

  • Primary key(document_id, organization_id)

DDL

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

CREATE TABLE IF NOT EXISTS "document_discovery_heads" (
  "document_id" TEXT NOT NULL,
  "organization_id" TEXT NOT NULL,
  "manifest_hash" TEXT NOT NULL,
  "access_epoch" INTEGER NOT NULL,
  "links_json" TEXT NOT NULL,
  PRIMARY KEY ("document_id", "organization_id")
);