Skip to content

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

refactor(core): extract type aliases for storage callback and fence types

Steven Enamakele172a8bda770
diff --git a/crates/openhuman-core/src/modules/ops.rs b/crates/openhuman-core/src/modules/ops.rs
index 28451b94f1..e112a92395 100644
--- a/crates/openhuman-core/src/modules/ops.rs
+++ b/crates/openhuman-core/src/modules/ops.rs
@@ -222,17 +222,18 @@ fn needs_storage_callback(id: &str) -> bool {
}
/// Serializes creation and retention of module-scoped storage callback bindings.
-static STORAGE_CALLBACK_LOADS: std::sync::LazyLock<
- tokio::sync::Mutex<
- std::collections::HashMap<
- String,
- (
- std::sync::Arc<tinybus::module::HostCallbackBinding>,
- tinystoragedrivers_busproxy::ServedStorage,
- ),
- >,
+type StorageCallbackLoads = tokio::sync::Mutex<
+ std::collections::HashMap<
+ String,
+ (
+ std::sync::Arc<tinybus::module::HostCallbackBinding>,
+ tinystoragedrivers_busproxy::ServedStorage,
+ ),
>,
-> = std::sync::LazyLock::new(|| tokio::sync::Mutex::new(std::collections::HashMap::new()));
+>;
+
+static STORAGE_CALLBACK_LOADS: std::sync::LazyLock<StorageCallbackLoads> =
+ std::sync::LazyLock::new(|| tokio::sync::Mutex::new(std::collections::HashMap::new()));
async fn ensure_loaded_with_storage_callback(
resolver: &Resolver,
diff --git a/crates/openhuman-core/src/modules/storage_host.rs b/crates/openhuman-core/src/modules/storage_host.rs
index b78bb1ec0c..cd15511989 100644
--- a/crates/openhuman-core/src/modules/storage_host.rs
+++ b/crates/openhuman-core/src/modules/storage_host.rs
@@ -696,7 +696,7 @@ pub(super) async fn prepare_module_callbacks(
tinystoragedrivers_busproxy::ServedStorage,
)> {
let connection = runtime.connection();
- prepare_callbacks(&connection, runtime.host()).await
+ prepare_callbacks(connection, runtime.host()).await
}
/// Prepare a callback storage endpoint for a module host on `connection`.
diff --git a/crates/openhuman-core/src/storage/fenced_backend.rs b/crates/openhuman-core/src/storage/fenced_backend.rs
index 2eef2b24be..b4fdab1953 100644
--- a/crates/openhuman-core/src/storage/fenced_backend.rs
+++ b/crates/openhuman-core/src/storage/fenced_backend.rs
@@ -16,6 +16,8 @@ use tinystoragedrivers_types::WriteCondition;
use super::fence::{FenceRegistry, LeaseFence};
+type FencedWriteCondition = Option<(Arc<LeaseFence>, Option<WriteCondition>)>;
+
/// A backend whose scope handles carry the applicable host lease condition.
pub struct FencedBackend {
inner: Arc<dyn StorageBackend>,
@@ -66,7 +68,7 @@ impl FencedBackend {
fn condition_for(
&self,
scope: &Scope,
- ) -> Result<Option<(Arc<LeaseFence>, Option<WriteCondition>)>, StorageError> {
+ ) -> Result<FencedWriteCondition, StorageError> {
let fence = if let Some(captured) = &self.captured {
if !captured.covers(scope.as_str()) {
return Err(StorageError::backend(