Expand description
Data retention: which vault blobs the database still refers to, the
removal of blobs nothing refers to (teamcraft vault gc, and the blobs of
expired staged imports and upload sessions) and the trimming of the
preview cache, and the removal of superseded versions of latest files
(purge_superseded_versions). The audit log retention is
audit::purge_older_than.
Referenced content is never removed. A blob is removed only when no
column of BLOB_COLUMNS names it and it was not written or stored
again within a grace period: the vault renews a blob’s modification time
whenever the same content is stored again (vault.rs), and every writer
stores the blob before it inserts the row that refers to it, so content on
its way into the database is always younger than the grace period. The
time is checked again right before the removal. A store of identical
content that overlaps the removal itself re-checks that the blob exists
after renewing it and puts its own copy in place otherwise; the remaining
window is a few instructions wide and only open for blobs that were idle
for the whole grace period.
Structs§
- GcReport
- Outcome of
collect_garbage. - Orphan
- An unreferenced blob found by
collect_garbage. - Preview
Purge - Outcome of
purge_previews. - Purged
File - The superseded versions of one file that
purge_superseded_versionsremoved (or, in a dry run, would remove). - Version
Purge - Outcome of
purge_superseded_versions.
Enums§
- Release
- What
release_blobdid.
Constants§
- BLOB_
COLUMNS - Every column that may name a vault blob by its SHA-256 – the files and
their versions, change request attachments, staged STEP imports and
upload sessions (the stored content, and the hashes the client announced
or started from).
shape_signatures.sha256is derived data andbranding_logos.sha256the hash of bytes kept in the row; neither keeps a blob alive. A test checks this list against the migrations. - DEFAULT_
GC_ GRACE_ HOURS - Default grace period of
teamcraft vault gc. - DEFAULT_
LATEST_ GRACE_ DAYS - Default grace period before a superseded version of a
latestfile is removed (TEAMCRAFT_RETENTION_LATEST_GRACE_DAYS). - IN_
FLIGHT_ GRACE - Grace period of the housekeeping: blobs of expired staged imports and upload sessions written or stored again within the last hour stay (and the staged import with them, until the next run).
- MAX_
LATEST_ GRACE_ DAYS - Longest grace period accepted (ten years).
- NOT_
BLOB_ COLUMNS - Hash columns that are not references to vault content.
Functions§
- collect_
garbage teamcraft vault gc: walks the vault oneobjects/ab/directory at a time and finds the blobs no column ofBLOB_COLUMNSnames and that were not written or stored again withingrace. Only withapplyare they removed (each after a last check of its time).- purge_
previews - Trims the preview cache (
<vault>/previews): removes the previews and thumbnails of blobs the database no longer refers to, files of older cache versions and temporary files older than an hour; then, withmax_bytes> 0, the least recently used files until the cache fits. Files with other names are left alone. Everything removed is made again when it is needed. - purge_
superseded_ versions - Removes the old versions of files whose retention is
latest: a version goes when a newer version replaced it at leastgrace_daysago (the time of the next version’s upload counts, so a rollback or a mistaken upload can still be undone within the grace period). The blobs nothing refers to afterwards are removed from the vault. Withoutapplyit only reports. - referenced
- The hashes of
hashesthat a column ofBLOB_COLUMNSnames. - release_
blob - Removes one blob if nothing in the database refers to it – as seen by
conn, so a caller can delete the last referring row in the same transaction first – and it is older thangrace.