Parent
Part of #1402. Depends on Phase 3 and Phase 3.5.
Goal
Move the archive worker and DB writers into core::persistence (inside the root-level core crate), and switch persistence from sharing the MonitorResources Arc<Mutex> bag to subscribing to the EventBus.
Workspace Context
core::persistence::* lives at core/src/persistence/ inside the workspace core crate. The DB infrastructure that backs it lands at core/src/infrastructure/database/. None of these may depend on tauri.
Scope
- Relocate
src-tauri/src/workers/hardware_archive.rs → core/src/persistence/archive.rs.
- Move the relevant pieces of
src-tauri/src/infrastructure/database/ (writers, archive logic, scheduled deletion, schema preflight) into the core crate at core/src/persistence/ and core/src/infrastructure/database/.
- Persistence subscribes to the EventBus instead of sharing the
Arc<Mutex> history bag with the collector.
core::persistence::preflight::check_db_compatibility() (moved in Phase 3.5) is still callable from App — it is consumed by the startup dialog in src-tauri/src/app/startup.rs.
Out of Scope
- Lifecycle changes (Phase 5).
- Tray UI (Phase 6).
- Schema redesigns or migrations.
Definition of Done
- Archive feature continues to record data correctly.
- An integration test simulates DB-write latency (e.g. injected delay in the writer) and asserts that sensor polling cadence is unaffected.
core/src/persistence/ has unit tests that run via cargo test -p <core-crate> without a Tauri runtime.
- No user-visible regression in the Insight (30-day history) view.
Parent
Part of #1402. Depends on Phase 3 and Phase 3.5.
Goal
Move the archive worker and DB writers into
core::persistence(inside the root-levelcorecrate), and switch persistence from sharing theMonitorResourcesArc<Mutex>bag to subscribing to the EventBus.Workspace Context
core::persistence::*lives atcore/src/persistence/inside the workspacecorecrate. The DB infrastructure that backs it lands atcore/src/infrastructure/database/. None of these may depend ontauri.Scope
src-tauri/src/workers/hardware_archive.rs→core/src/persistence/archive.rs.src-tauri/src/infrastructure/database/(writers, archive logic, scheduled deletion, schema preflight) into thecorecrate atcore/src/persistence/andcore/src/infrastructure/database/.Arc<Mutex>history bag with the collector.core::persistence::preflight::check_db_compatibility()(moved in Phase 3.5) is still callable from App — it is consumed by the startup dialog insrc-tauri/src/app/startup.rs.Out of Scope
Definition of Done
core/src/persistence/has unit tests that run viacargo test -p <core-crate>without a Tauri runtime.