Skip to content

Files and blobs

Partial

Files keep the opaque bytes that go with a fleet (a firmware image, a config dump, a runbook, a capture) searchable and deduplicated: a file handle over a content-addressed blob store, behind the same Storage Gateway, the one layer every database read and write passes through, as everything else (ADR-0029). To use them, see the admin Files page.

  • file is indexable metadata: filename, content type, size and sha256. It owns no bytes. The filename is a human label with an extension, not a name, so it has no name rule and no uniqueness. A route takes the handle by uuid or by filename, and a filename shared by several files is refused with each candidate’s uuid (ADR-1133).
  • the blob store holds the bytes, keyed by sha256, so identical bytes are one blob.

Search and listing never touch bytes, and one blob can back many handles.

A file has no fleet placement: it relates to many things (one firmware image documents many device types) or to none, so it is install-wide, gated by two layers:

  • the file:<action> permission on every route (download rides file:read);
  • a per-file sensitive flag reusing the secret sensitivity tier (ADR-0025): a flagged file needs file:read:admin, is hidden from a lister, and is a non-disclosing 404 to a reader without it.

Unlike a secret the flag defaults false, so the viewer floor reads ordinary files.

A blob is keyed by the hash of its bytes, which gives dedup, integrity (the hash verifies the bytes on read), immutability, and stability for anything that references a hash. The key is the bare sha256 with no tenant id: isolation is per database, so dedup is global within one install and never visible across installs. The default backend is pgblobs, a dedicated Postgres table, which keeps the single-binary story. A file delete frees its blob synchronously when nothing else references it.

file (content): generated from the migrated schema by make gen
Column Type Constraints Notes
id uuid PK, default uuidv7()
name text not null
content_type text not null
size bigint not null
sha256 text FK → blob.sha256, not null The content address of the bytes this handle names
sensitive boolean not null, default false Lifts the row to the :admin tier
created_at timestamp with time zone not null, default now()
updated_at timestamp with time zone not null, default now()
blob (content): generated from the migrated schema by make gen
Column Type Constraints Notes
sha256 text PK The content address; dedup key across every referencing file
bytes bytea not null
size bigint not null
created_at timestamp with time zone not null, default now()