feat(#2635): consolidate todos + reminders into one hyperhive-state.sqlite
This commit is contained in:
parent
64a14718fe
commit
c316dc852d
3 changed files with 261 additions and 7 deletions
|
|
@ -40,19 +40,52 @@ pub fn harness_dir() -> PathBuf {
|
|||
hive_sh4re::paths::harness_dir()
|
||||
}
|
||||
|
||||
/// Harness-local todo store (loose-ends v2). A dedicated sqlite db under
|
||||
/// the harness dir — the todos are mutable per-agent state the harness
|
||||
/// owns, kept out of the append-only `hyperhive-events.sqlite` sink.
|
||||
/// Consolidated harness-local state db — currently todos + reminders, one
|
||||
/// table each — mutable per-agent state the harness owns, kept out of the
|
||||
/// append-only `hyperhive-events.sqlite` sink. Per mara's call ("not yet
|
||||
/// another sqlite! todos, reminders, questions should be like three tiny
|
||||
/// tables in one 500kb sqlite"), this file is the shared home for all
|
||||
/// loose-ends-v2 stores; each store's `open()` only applies its own
|
||||
/// `CREATE TABLE IF NOT EXISTS`, so opening multiple stores against the
|
||||
/// same path is safe (distinct table names, no schema collision). A
|
||||
/// questions mirror table is the planned third tenant (a following
|
||||
/// increment), not part of this schema yet.
|
||||
/// [`todos_db`] and [`reminders_db`] both resolve here — kept as separate
|
||||
/// fns (rather than every call site reading `state_db` directly) so each
|
||||
/// store's callers still say what they mean.
|
||||
///
|
||||
/// Before this consolidation, todos and reminders lived in their own
|
||||
/// `hyperhive-todos.sqlite` / `hyperhive-reminders.sqlite` files; a
|
||||
/// one-time boot migration (`db_migrate::run`) folds those into this path
|
||||
/// the first time a harness boots after the upgrade.
|
||||
#[must_use]
|
||||
pub fn state_db() -> PathBuf {
|
||||
harness_dir().join("hyperhive-state.sqlite")
|
||||
}
|
||||
|
||||
/// Harness-local todo store (loose-ends v2) path — see [`state_db`].
|
||||
#[must_use]
|
||||
pub fn todos_db() -> PathBuf {
|
||||
state_db()
|
||||
}
|
||||
|
||||
/// Harness-local reminder store path — see [`state_db`].
|
||||
#[must_use]
|
||||
pub fn reminders_db() -> PathBuf {
|
||||
state_db()
|
||||
}
|
||||
|
||||
/// Legacy pre-consolidation todos db path, consulted only by
|
||||
/// [`crate::db_migrate`] on the first boot after the upgrade.
|
||||
#[must_use]
|
||||
pub fn legacy_todos_db() -> PathBuf {
|
||||
harness_dir().join("hyperhive-todos.sqlite")
|
||||
}
|
||||
|
||||
/// Harness-local reminder store. Same rationale as [`todos_db`] — mutable
|
||||
/// per-agent state the harness owns, kept out of the append-only events
|
||||
/// sink.
|
||||
/// Legacy pre-consolidation reminders db path, consulted only by
|
||||
/// [`crate::db_migrate`] on the first boot after the upgrade.
|
||||
#[must_use]
|
||||
pub fn reminders_db() -> PathBuf {
|
||||
pub fn legacy_reminders_db() -> PathBuf {
|
||||
harness_dir().join("hyperhive-reminders.sqlite")
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue