The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
refactor(storage): split storage module into submodules
Steven Enamakelf35ccdb8aeff
diff --git a/crates/openhuman-core/src/storage/mod.rs b/crates/openhuman-core/src/storage/mod.rsindex 1ff9cf94e8..33b2042d72 100644--- a/crates/openhuman-core/src/storage/mod.rs+++ b/crates/openhuman-core/src/storage/mod.rs@@ -19,6 +19,9 @@//! misconfigured deployment stops at boot instead of at its first write.pub mod documents;+pub mod lease;+mod lease_documents;+mod lease_local;pub mod secrets;use std::future::Future;@@ -207,6 +210,16 @@ pub fn driver_is_shared(driver: &str) -> bool {driver == "mongodb"}+/// Whether a backend with this driver name makes a compare-and-swap+/// (`Precondition::Version` / `Absent`) atomic across processes, which a+/// [`lease::DocumentLeases`] needs to exclude other nodes. MongoDB and SQLite+/// do (a database-side conditional write; SQLite's immediate transaction+/// under the file lock); the memory driver lives in one process, and the+/// file driver checks versions in-process only.+pub fn driver_has_cross_process_cas(driver: &str) -> bool {+ matches!(driver, "mongodb" | "sqlite")+}+/// Whether the installed backend may be shared with other processes; `false`/// when none is installed. See [`driver_is_shared`].pub fn installed_is_shared() -> bool {diff --git a/crates/openhuman-core/src/storage/mod_tests.rs b/crates/openhuman-core/src/storage/mod_tests.rsindex f6c173b6ef..a7ac671db5 100644--- a/crates/openhuman-core/src/storage/mod_tests.rs+++ b/crates/openhuman-core/src/storage/mod_tests.rs@@ -104,3 +104,13 @@ fn only_mongodb_is_shared_between_processes() {assert!(!driver_is_shared(driver), "{driver}");}}++#[test]+fn only_mongodb_and_sqlite_have_cross_process_cas() {+ for driver in ["mongodb", "sqlite"] {+ assert!(driver_has_cross_process_cas(driver), "{driver}");+ }+ for driver in ["memory", "file", "", "postgres"] {+ assert!(!driver_has_cross_process_cas(driver), "{driver}");+ }+}