pub trait AttachmentStore: Send + Sync {
// Required methods
fn put<'life0, 'async_trait>(
&'life0 self,
bytes: Vec<u8>,
meta: AttachmentCreateMeta,
) -> Pin<Box<dyn Future<Output = Result<AttachmentRef, AttachmentStoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 AttachmentId,
) -> Pin<Box<dyn Future<Output = Result<StoredAttachment, AttachmentStoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 AttachmentId,
) -> Pin<Box<dyn Future<Output = Result<(), AttachmentStoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
// Provided methods
fn persistence(&self) -> AttachmentStorePersistence { ... }
fn pending_manifest_commit_ids(&self) -> Vec<AttachmentId> { ... }
fn mark_manifest_committed(&self, _ids: &[AttachmentId]) { ... }
}Required Methods§
fn put<'life0, 'async_trait>(
&'life0 self,
bytes: Vec<u8>,
meta: AttachmentCreateMeta,
) -> Pin<Box<dyn Future<Output = Result<AttachmentRef, AttachmentStoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 AttachmentId,
) -> Pin<Box<dyn Future<Output = Result<StoredAttachment, AttachmentStoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Sourcefn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 AttachmentId,
) -> Pin<Box<dyn Future<Output = Result<(), AttachmentStoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 AttachmentId,
) -> Pin<Box<dyn Future<Output = Result<(), AttachmentStoreError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Unconditionally remove the content addressed by id (its payload bytes
and any metadata sidecar). Idempotent: deleting content that is already
absent returns Ok(()).
§Sharing safety — read before calling
This is a content-addressed delete, not a reference-aware one. The id
is a SHA-256 of the bytes, so any session that writes identical bytes
produces the same id and shares one stored object. Deleting by bare id
therefore removes the bytes for every session that references them.
The store holds no reference information — that lives in the write-ahead
AttachmentManifest, which is likewise keyed
by content id, so at most one row exists per distinct content and a set
committed_at means some durable session state references it.
Callers MUST establish that no session references the content before
deleting — for example, only delete ids returned by
AttachmentManifest::list_uncommitted,
which are never committed by any session and are thus provably
unreferenced. reclaim_orphaned_attachments is the intended safe
caller; prefer it over calling delete directly.
Provided Methods§
fn persistence(&self) -> AttachmentStorePersistence
Sourcefn pending_manifest_commit_ids(&self) -> Vec<AttachmentId>
fn pending_manifest_commit_ids(&self) -> Vec<AttachmentId>
Attachment refs written by this store that still need their write-ahead manifest rows stamped by the next runtime commit.
Plain stores return an empty set. SessionScopedAttachmentStore
overrides this so attachments created through downstream tools,
process execution, and other runtime services are committed by the
same final turn transaction that makes them reachable from session
state.
Sourcefn mark_manifest_committed(&self, _ids: &[AttachmentId])
fn mark_manifest_committed(&self, _ids: &[AttachmentId])
Clear attachment refs that were stamped committed by a successful runtime commit.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".