Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore(core): remove unused store modules

Steven Enamakel116122c22ab0
diff --git a/crates/openhuman-core/src/cron/store.rs b/crates/openhuman-core/src/cron/store.rs
index ec89293d57..f38bf60044 100644
--- a/crates/openhuman-core/src/cron/store.rs
+++ b/crates/openhuman-core/src/cron/store.rs
@@ -23,16 +23,6 @@ use tinyflows_schedule::{
use super::limits;
use tinyflows_schedule::AgentJobSpec;
-/// The cron store's own database for `config`: `<workspace>/cron/schedule.db`,
-/// or the agent's `<workspace>/agents/<id>/cron/schedule.db` under an embedded
-/// agent's context, so an agent lists, edits and runs only the jobs it
-/// created. Used only when no storage backend is installed.
-pub fn db_path(config: &Config) -> std::path::PathBuf {
- crate::core::runtime::agent_scope_dir(config)
- .join("cron")
- .join("schedule.db")
-}
-
/// The cron database tinyflows used to write, imported on first use.
pub fn legacy_db_path(config: &Config) -> std::path::PathBuf {
crate::storage::import::tinyflows::legacy_jobs_db(&crate::core::runtime::agent_scope_dir(
@@ -42,43 +32,13 @@ pub fn legacy_db_path(config: &Config) -> std::path::PathBuf {
/// The cron job store for this call, in the acting agent's scope.
fn documents(config: &Config) -> Result<CronDocuments> {
- let opened = crate::storage::local::open_standing(
- &db_path(config),
- "cron::store",
- config,
- &|backend, scope, config| legacy_import(backend, scope, config),
- )?;
+ let opened = crate::storage::local::open("cron::store", &config.workspace_dir)?;
Ok(
CronDocuments::new(std::sync::Arc::clone(opened.scoped()?.documents()))
.with_limits(config.cron.max_run_history, config.scheduler.max_tasks),
)
}
-/// Brings `jobs.db` into a freshly opened per-store database (the default
-/// layout; with a backend installed the boot-time import did it).
-#[cfg(feature = "flows")]
-fn legacy_import(
- backend: &std::sync::Arc<dyn crate::storage::StorageBackend>,
- scope: &crate::storage::Scope,
- config: &Config,
-) -> Result<()> {
- let dir = crate::core::runtime::agent_scope_dir(config);
- crate::storage::import::tinyflows::import_cron(backend, scope, config, &dir, "")?;
- Ok(())
-}
-
-#[cfg(not(feature = "flows"))]
-fn legacy_import(
- _backend: &std::sync::Arc<dyn crate::storage::StorageBackend>,
- _scope: &crate::storage::Scope,
- config: &Config,
-) -> Result<()> {
- if legacy_db_path(config).is_file() {
- tracing::warn!("[cron:store] built without `flows`; the legacy jobs.db is not imported");
- }
- Ok(())
-}
-
/// Runs a document-store call from this synchronous API.
fn run<T: Send + 'static>(
future: impl std::future::Future<Output = Result<T>> + Send + 'static,
diff --git a/crates/openhuman-core/src/flows/store.rs b/crates/openhuman-core/src/flows/store.rs
index 7e050d3a44..7a4773732f 100644
--- a/crates/openhuman-core/src/flows/store.rs
+++ b/crates/openhuman-core/src/flows/store.rs
@@ -2,11 +2,10 @@
//!
//! The catalog is `tinyflows_drivers::catalog::FlowCatalogDocuments`: flows,
//! revisions, runs, state, suggestions and drafts as documents on the storage
-//! ports, in the acting agent's scope of the installed backend
-//! ([`crate::storage`]) or, when the host configured none, in a SQLite
-//! document store of its own (`<workspace>/flows/catalog.db`). tinyflows no
+//! ports, in the acting agent's scope of the storage backend
+//! ([`crate::storage`]). tinyflows no
//! longer has a SQLite store: the `flows.db`, `checkpoints.db` and
-//! `drafts/*.json` it wrote are imported once, read-only, on first use
+//! `drafts/*.json` it wrote are imported once, read-only, when the backend is installed
//! ([`crate::storage::import`]).
//!
//! Every function below is that one substitution and nothing else. They are
@@ -25,12 +24,6 @@ use tinyflows_catalog::{
use tinyflows_drivers::catalog::FlowCatalogDocuments;
-/// Where this host keeps the flow catalog's own database when no storage
-/// backend is installed: `<workspace_dir>/flows/catalog.db`.
-pub fn db_path(config: &Config) -> PathBuf {
- dir(config).join("catalog.db")
-}
-
/// Where tinyflows kept its flow files: `<workspace_dir>/flows`
/// (`flows.db`, `checkpoints.db`, `drafts/`). Read once by the importer.
pub fn dir(config: &Config) -> PathBuf {
@@ -38,27 +31,9 @@ pub fn dir(config: &Config) -> PathBuf {
}
/// The storage the flow catalog and its checkpoints use for this call: the
-/// installed backend in the acting scope, else the workspace's own database
-/// (see [`crate::storage::local::open_standing`]).
+/// storage backend in the acting scope ([`crate::storage::local::open`]).
pub(crate) fn scoped(config: &Config) -> Result<crate::storage::ScopedStorage> {
- let opened = crate::storage::local::open_standing(
- &db_path(config),
- "flows::store",
- config,
- &|backend, scope, config| legacy_import(backend, scope, config),
- )?;
- opened.scoped()
-}
-
-/// Brings the legacy flow files into a freshly opened workspace database (the
-/// default layout; with a backend installed the boot-time import did it).
-fn legacy_import(
- backend: &std::sync::Arc<dyn crate::storage::StorageBackend>,
- scope: &crate::storage::Scope,
- config: &Config,
-) -> Result<()> {
- crate::storage::import::tinyflows::import_flows(backend, scope, config)?;
- Ok(())
+ crate::storage::local::open("flows::store", &config.workspace_dir)?.scoped()
}
/// The document catalog for this call.