payloads

Raw vendor responses, a purgeable cache tier (ADR-030)

What you'll learn

You're writing SQL that reads payloads and need its columns, what each holds, and the DDL as the spec states it.

  • every column and its type
  • what the object holds and who writes it
  • the DDL as the spec states it

A table. Raw vendor responses, a purgeable cache tier (ADR-030) — never facts.

Columns

ColumnTypeConstraints
idTEXTPRIMARY KEY
identity_idTEXTNOT NULL REFERENCES identities(id)
adapterTEXTNOT NULL
run_idTEXT
content_typeTEXT
bodyTEXTNOT NULL
created_atTEXTNOT NULL
expires_atTEXT

Definition

From spec/ledger.sql, which is the machine-checkable form of SPEC.md §3:

CREATE TABLE payloads (
  id           TEXT PRIMARY KEY,          -- ULID
  identity_id  TEXT NOT NULL REFERENCES identities(id),
  adapter      TEXT NOT NULL,             -- adapter id that fetched it
  run_id       TEXT,
  content_type TEXT,                      -- e.g. application/json, text/markdown
  body         TEXT NOT NULL,
  created_at   TEXT NOT NULL,
  expires_at   TEXT
);
CREATE INDEX ix_payloads_lookup ON payloads(identity_id, adapter, created_at DESC);
CREATE INDEX ix_payloads_expiry ON payloads(expires_at);