M1 step 3: Log writing and Storage Clean-up

- lib/storage_model (host-tested): FAT-safe names, daily Log paths,
  dates from Log/Capture file names, CleanupPlan by category and age,
  byte formatting
- StorageService does all card I/O on its task: queued Log lines are
  written in batches each second (dropped while Logs are paused),
  plus file listing and deletion jobs
- Settings > Storage moves into StoragePage: usage, Clean up
  (category, age with size preview, confirmation), Erase SD card
- Clock: local date for Log names
- Serial: log <text>, sd list

Verified on the device: lines land in /irc/dev/#test/2026-10-02.log
with folders created as needed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
This commit is contained in:
2026-10-02 14:56:06 +02:00
co-authored by Claude Opus 5.5
parent 1a0baf4ac7
commit d3948ccc3a
18 changed files with 785 additions and 74 deletions
+22
View File
@@ -0,0 +1,22 @@
#pragma once
#include <cstdint>
#include <initializer_list>
#include <string>
namespace roro::storage {
// Makes one path component safe for FAT: forbidden characters become '_', never empty or a dot name.
std::string sanitize(const std::string& name);
// "/irc/libera/#roro/2026-10-02.log" from {"irc", "libera", "#roro"} and a local date
// ("YYYY-MM-DD"); an empty date (clock not set yet) gives "undated.log".
std::string dailyLogPath(std::initializer_list<std::string> folders, const std::string& date);
// Day number (days since 1970-01-01) encoded in a Log ("2026-10-02.log") or Capture
// ("20261002-144500.pcap") file name, or -1 if the name carries no valid date.
int fileDay(const std::string& fileName);
int dayFromUtc(int64_t utcSeconds);
} // namespace roro::storage