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
feat(storage): forward remaining backend and store methods through the fence
Steven Enamakel793abe729740
diff --git a/crates/openhuman-core/src/storage/fenced_backend.rs b/crates/openhuman-core/src/storage/fenced_backend.rsindex 4630c85f83..cd3cdf39b3 100644--- a/crates/openhuman-core/src/storage/fenced_backend.rs+++ b/crates/openhuman-core/src/storage/fenced_backend.rs@@ -61,29 +61,15 @@ impl FencedBackend {}}-/// `inner` fenced by the process's registry ([`super::fence::registry`]).-pub fn wrap(inner: Arc<dyn StorageBackend>) -> Arc<dyn StorageBackend> {- Arc::new(FencedBackend::new(inner, super::fence::registry()))-}--#[async_trait]-impl StorageBackend for FencedBackend {- fn driver(&self) -> &'static str {- self.inner.driver()- }-- fn capabilities(&self) -> Capabilities {- self.inner.capabilities()- }-- fn for_scope(&self, scope: &Scope) -> Result<ScopedStorage> {- let scoped = self.inner.for_scope(scope)?;+impl FencedBackend {+ /// `scoped`'s handles with every write passing the scope's fence.+ fn wrap_scoped(&self, scope: &Scope, scoped: &ScopedStorage) -> ScopedStorage {let guard = Guard {scope: scope.clone(),fences: Arc::clone(&self.fences),backend: Some(Arc::clone(&self.inner)),};- Ok(ScopedStorage::new(+ ScopedStorage::new(scope.clone(),scoped.driver(),Arc::new(FencedDocuments {@@ -98,7 +84,86 @@ impl StorageBackend for FencedBackend {inner: Arc::clone(scoped.blobs()),guard,}),- ))+ )+ }+}++/// `inner` fenced by the process's registry ([`super::fence::registry`]).+pub fn wrap(inner: Arc<dyn StorageBackend>) -> Arc<dyn StorageBackend> {+ Arc::new(FencedBackend::new(inner, super::fence::registry()))+}++#[async_trait]+impl StorageBackend for FencedBackend {+ fn driver(&self) -> &'static str {+ self.inner.driver()+ }++ fn capabilities(&self) -> Capabilities {+ self.inner.capabilities()+ }++ fn for_scope(&self, scope: &Scope) -> Result<ScopedStorage> {+ let scoped = self.inner.for_scope(scope)?;+ Ok(self.wrap_scoped(scope, &scoped))+ }++ fn document_driver(&self) -> &'static str {+ self.inner.document_driver()+ }++ fn existing_schema(&self) -> Result<Arc<dyn StorageBackend>> {+ Ok(Arc::new(Self {+ inner: self.inner.existing_schema()?,+ fences: Arc::clone(&self.fences),+ }))+ }++ async fn prepare_schema(&self) -> Result<()> {+ self.inner.prepare_schema().await+ }++ /// The driver's own fenced handles; the fence wrapper itself builds on+ /// these, so they are not wrapped a second time.+ fn for_scope_fenced(&self, scope: &Scope, fence: &tinystoragedrivers::Fence) -> Result<ScopedStorage> {+ self.inner.for_scope_fenced(scope, fence)+ }++ fn for_scope_generation(+ &self,+ scope: &Scope,+ generation: tinystoragedrivers::ScopeGeneration,+ ) -> Result<ScopedStorage> {+ let scoped = self.inner.for_scope_generation(scope, generation)?;+ Ok(self.wrap_scoped(scope, &scoped))+ }++ fn for_scope_fenced_generation(+ &self,+ scope: &Scope,+ generation: tinystoragedrivers::ScopeGeneration,+ fence: &tinystoragedrivers::Fence,+ ) -> Result<ScopedStorage> {+ self.inner.for_scope_fenced_generation(scope, generation, fence)+ }++ async fn maintain(+ &self,+ budget: tinystoragedrivers::MaintenanceBudget,+ ) -> Result<tinystoragedrivers::MaintenanceReport> {+ self.inner.maintain(budget).await+ }++ async fn checkpoint(&self, mode: tinystoragedrivers::Checkpoint) -> Result<()> {+ self.inner.checkpoint(mode).await+ }++ async fn scopes(&self, prefix: &str) -> Result<Vec<Scope>> {+ self.inner.scopes(prefix).await+ }++ async fn scopes_of_tenant(&self, tenant: &Scope) -> Result<Vec<Scope>> {+ self.inner.scopes_of_tenant(tenant).await}/// Reclaiming blobs that already read as absent changes nothing a reader@@ -234,6 +299,23 @@ impl DocumentStore for FencedDocuments {)}+ /// Forwarded (and fenced): without it the trait default refuses a write that+ /// declares a schema version or expiry, which is every owner's write.+ async fn put_with(+ &self,+ collection: &str,+ id: &str,+ doc: Value,+ precondition: Precondition,+ options: tinystoragedrivers::WriteOptions,+ ) -> Result<Version> {+ fenced_write!(+ self,+ "documents.put_with",+ documents.put_with(collection, id, doc, precondition, options)+ )+ }+async fn delete(&self, collection: &str, id: &str, precondition: Precondition) -> Result<bool> {fenced_write!(self,@@ -384,6 +466,23 @@ impl StreamStore for FencedStreams {async fn streams(&self, prefix: &str) -> Result<Vec<String>> {self.inner.streams(prefix).await}++ async fn info(&self, stream: &str) -> Result<Option<tinystoragedrivers::StreamInfo>> {+ self.inner.info(stream).await+ }++ /// Forwarded (and fenced): sealing a finished stream is a write.+ async fn seal(&self, stream: &str) -> Result<tinystoragedrivers::SealOutcome> {+ fenced_write!(self, "streams.seal", streams.seal(stream))+ }++ async fn delete_sealed_stream(&self, stream: &str, sealed_ms: i64) -> Result<bool> {+ fenced_write!(+ self,+ "streams.delete_sealed_stream",+ streams.delete_sealed_stream(stream, sealed_ms)+ )+ }}struct FencedBlobs {