Skip to content

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

feat(storage): add fence registry to fenced backend creation

Steven Enamakel12417dc5be93
diff --git a/crates/openhuman-core/src/profiles/host_backend.rs b/crates/openhuman-core/src/profiles/host_backend.rs
index 0b5f104576..63adb0354a 100644
--- a/crates/openhuman-core/src/profiles/host_backend.rs
+++ b/crates/openhuman-core/src/profiles/host_backend.rs
@@ -29,6 +29,7 @@ impl ProfileHost {
};
Ok(Some(Arc::new(FencedBackend::for_fence(
Arc::clone(backend),
+ Arc::clone(&self.fences),
Arc::clone(profile.lease_fence()),
))))
}
diff --git a/crates/openhuman-core/src/storage/fenced_backend.rs b/crates/openhuman-core/src/storage/fenced_backend.rs
index 1bed199bf7..48ed60ae2c 100644
--- a/crates/openhuman-core/src/storage/fenced_backend.rs
+++ b/crates/openhuman-core/src/storage/fenced_backend.rs
@@ -46,10 +46,16 @@ impl FencedBackend {
/// admitted when a particular profile was captured. It fails closed for
/// scopes outside the captured fence, and does not consult or follow a
/// replacement fence in the registry.
- pub fn for_fence(inner: Arc<dyn StorageBackend>, fence: Arc<LeaseFence>) -> Self {
+ pub fn for_fence(
+ inner: Arc<dyn StorageBackend>,
+ clock: Arc<FenceRegistry>,
+ fence: Arc<LeaseFence>,
+ ) -> Self {
Self {
inner,
- registry: None,
+ // The registry supplies this host's clock only. Captured backends
+ // never look up a replacement fence in it.
+ registry: Some(clock),
captured: Some(fence),
}
}