Tearleads

document_updates API Postgres table

Each document's encrypted Loro update history: one row per accepted update. A row holds ciphertext the server never decrypts and the signed metadata it validates before committing: version-vector spans, dependencies, and the plaintext hash.

Declared in packages/loro/src/server/schema.ts

Columns

  • sequenceinteger
    • primary key
    • not null
    • default generated always as identity

    Commit order, assigned by the database; sync pulls page by it.

  • iduuid
    • not null
    • unique

    Update id chosen by the writer. Unique, so a retried upload of an accepted update is compared with the stored row instead of stored twice.

  • document_iduuid
    • not null

    The document the update belongs to.

  • access_epochinteger
    • not null

    The document access epoch the update was accepted under.

  • author_fingerprinttext
    • not null

    Fingerprint of the key the update's write header was verified under: the writer's root key or one of their devices' keys.

  • encrypted_datatext
    • not null

    The encrypted Loro update bytes.

  • byte_lengthinteger
    • not null

    UTF-8 byte length of encryptedData.

  • partial_start_version_vectortext
    • not null

    The version-vector span the update covers, as its writer signed it.

  • partial_end_version_vectortext
    • not null

    The version-vector span the update covers, as its writer signed it.

  • dependency_version_vectortext
    • not null

    The ops the update depends on outside itself, as its writer signed them: committed when it was accepted, and what readers check the payload's own dependencies against.

  • plaintext_hashtext
    • not null

    The writer's per-record keyed hash of the plaintext update.

  • created_attimestamp
    • not null
    • default now()

    When the server stored the update.

Indexes

  • document_updates_document_sequence_idx(document_id, sequence)