Skip to content

Archive Storage & Directory File Layout ​

RUSEON Core organizes recorded video files in a clean, stream-isolated directory structure. This design enables instantaneous timeline range indexing, robust crash recovery, and efficient retention cleanup.


1. Directory Hierarchy ​

All recordings are stored under the root recordings/ directory:

text
recordings/
├── cam-entrance-01/
│   ├── 2026-08-23_14-00-00_to_15-00-00.mp4
│   ├── 2026-08-23_15-00-00_to_16-00-00.mp4
│   └── 2026-08-23_16-00-00_ongoing.mp4
└── cam-warehouse-02/
    ├── 2026-08-23_14-00-00_to_15-00-00.mp4
    └── 2026-08-23_15-00-00_ongoing.mp4

2. Path & Filename Specification ​

SegmentFormatDescriptionExample
Rootrecordings/Base archive directory./recordings
Camera Folder{camera_id}/Dedicated directory per camera streamcam-entrance-01/
Active Recording{start}_ongoing.mp4Live file actively being appended with fMP4 parts2026-08-23_16-00-00_ongoing.mp4
Completed Hourly{start}_to_{end}.mp4Rotated standalone fMP4 file2026-08-23_14-00-00_to_15-00-00.mp4
Corrupted/Failed{start}.corruptedMarked on unrecoverable write failure2026-08-23_14-00-00.corrupted

3. High-Speed In-Memory Indexing (IndexLRUCache) ​

  • Zero Database Dependency: Archive timelines (GET /api/cameras/:id/archive) are dynamically discovered by scanning recordings/{camera_id}/ using internal/archive/indexer.go.
  • LRU Cache (IndexLRUCache): Fast seek and playback queries parse fMP4 moof + mdat box offsets directly from files and cache index structures in memory (capacity: 2,000 files).
  • Direct MP4 Clip Export: ExportMP4 copies the ftyp + moov init header and chosen movie parts directly to HTTP response streams without disk re-encoding.

4. Storage Mount Best Practices ​

For Linux production deployments, mount your recording storage volume with high-throughput options:

bash
# Recommended /etc/fstab mount options for XFS / ext4 recording volumes
UUID=... /app/recordings ext4 noatime,nodiratime,data=ordered 0 2

Released under the MIT License.