Adventure Labs Logo
Scout Docs

Herd media usage

Point-in-time snapshots of stored media bytes for a herd

Column NameData TypeConstraints
idbigintNOT NULL
herd_idbigintNOT NULL, FK -> herds
storage_bytesbigintNOT NULL, >= 0
inserted_attimestamp with time zoneDEFAULT timezone('utc'::text, now()) NOT NULL

Each row records stored bytes for devices currently in the herd, across the buckets listed by private.media_usage_bucket_ids(): events, event_thumbnails, event_proxies, artifacts, artifact_thumbnails, artifact_proxies, and embedding_thumbnails. The migration creates one initial snapshot per herd. Event, artifact, and media-storage changes refresh affected herds; unchanged totals are not duplicated. Changes broadcast on the private {herd_id}-herd_media_usage topic, which requires media.read.

Security Policies (RLS)

RLS enabled. Herd scope: herd_media_usage.herd_id.

Operationhas_herd_ability ability keyOther paths
SELECTmedia.readOwning device API key in herd
INSERT—Platform superadmin
UPDATE—Platform superadmin
DELETE—Platform superadmin

Platform superadmin: FOR ALL.

On this page