Archive retention¶
media.dvr.depth
Sapsan's DVR is its own on-disk storage: a stream is written append-only into hourly files, per track, across several disks at once. Archive reads do not interfere with writes.
Cleanup and retention¶
Cleanup runs once an hour (5 minutes after the hour boundary):
max_depthis hour-granular: only fully elapsed hours are deleted;- blobs with protected episodes are never deleted by retention;
- the blob of the current (actively written) hour is never deleted.
Disk-overflow protection works separately: when free space drops below min_free_bytes (default 1% of disk capacity), Sapsan deletes the oldest blobs regardless of retention until enough space is freed.
Episode retention in central¶
Central harvests the latest episode state and its images from streamers and stores them in PostgreSQL. Retained episodes remain readable while the source streamer is unavailable. This storage is independent of video recording.
In the stream or stream template DVR settings, Additional episode retention (hours) sets dvr.episodes_additional_depth; the API and YAML use seconds. The total is dvr.max_depth + dvr.episodes_additional_depth. An unset additional depth means zero. An unset max_depth in a present DVR section means ten years; explicit zero remains zero. Without a DVR section, or with a zero total, central does not retain episodes.
For closed episodes, the retention period starts at closed_at; for open episodes, it starts at updated_at. Changing the effective DVR settings, including the template, recalculates retention for all remaining episodes. A stream's own DVR section replaces the template section as a whole. Deleting a stream removes its episodes and images. Once background cleanup physically removes an episode, increasing retention cannot restore it.