Tearleads

organization_read_model_state Client SQLite table

Cursor and lane-level fields for one locally projected organization: the exact organization policy head, and the state hash of the reserved Members group's membership head, which the group catalog does not list.

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

Columns

  • organization_idtext
    • primary key
    • not null

    Organization this projection describes.

  • cursortext
    • not null

    nextCursor of the last read-model page applied, shared by every requester on this device. The next reconcile requests from it.

  • profile_document_idtext
    • nullable

    Id of the organization's encrypted profile document, from the directory lane; null when the organization has none.

  • member_group_idtext
    • not null

    Id of the reserved Members group.

  • member_group_state_hashtext
    • not null

    State hash of the Members group's delivered membership head.

  • organization_state_hashtext
    • not null

    State hash of the organization's current policy state.

  • organization_state_versioninteger
    • not null

    Version number of that policy state; genesis is 1.

  • organization_key_epochinteger
    • not null

    Key epoch of that policy state.

  • organization_key_fingerprinttext
    • not null

    Hex SHA-256 fingerprint of the organization's encapsulation public key at that epoch.

  • organization_member_countinteger
    • not null

    Member count that policy state commits to.

  • updated_attext
    • not null

    ISO-8601 time this device last applied a page that changed the row.

DDL

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

CREATE TABLE IF NOT EXISTS "organization_read_model_state" (
  "organization_id" TEXT NOT NULL PRIMARY KEY,
  "cursor" TEXT NOT NULL,
  "profile_document_id" TEXT,
  "member_group_id" TEXT NOT NULL,
  "member_group_state_hash" TEXT NOT NULL,
  "organization_state_hash" TEXT NOT NULL,
  "organization_state_version" INTEGER NOT NULL,
  "organization_key_epoch" INTEGER NOT NULL,
  "organization_key_fingerprint" TEXT NOT NULL,
  "organization_member_count" INTEGER NOT NULL,
  "updated_at" TEXT NOT NULL
);