pub struct ArtifactStore { /* private fields */ }Expand description
In-memory artifact store.
Implementations§
Source§impl ArtifactStore
impl ArtifactStore
Sourcepub const fn with_default_retention(self, duration: Duration) -> Self
pub const fn with_default_retention(self, duration: Duration) -> Self
Override the default retention duration.
Sourcepub fn put(
&self,
media_type: impl Into<String>,
data: &str,
retain_seconds: Option<u64>,
sha256: Option<String>,
) -> Result<ArtifactRef, ARCPError>
pub fn put( &self, media_type: impl Into<String>, data: &str, retain_seconds: Option<u64>, sha256: Option<String>, ) -> Result<ArtifactRef, ARCPError>
Store a base64-encoded body. Returns the new ArtifactRef.
§Errors
Returns ARCPError::InvalidArgument if data is not valid base64
or exceeds the inline size cap (4 MiB after base64 decode, per
PLAN.md §A4.11).
Sourcepub fn fetch(&self, id: &ArtifactId) -> Result<(String, String), ARCPError>
pub fn fetch(&self, id: &ArtifactId) -> Result<(String, String), ARCPError>
Fetch an artifact by id. Returns base64-encoded body alongside its
media_type.
§Errors
Returns ARCPError::NotFound if the artifact is unknown or has
expired (the store sweeps lazily on read).
Sourcepub fn release(&self, id: &ArtifactId)
pub fn release(&self, id: &ArtifactId)
Drop an artifact from the store (regardless of expiry).
Sourcepub fn sweep_expired(&self) -> usize
pub fn sweep_expired(&self) -> usize
Sweep expired artifacts. Returns the number removed.
Trait Implementations§
Source§impl Clone for ArtifactStore
impl Clone for ArtifactStore
Source§fn clone(&self) -> ArtifactStore
fn clone(&self) -> ArtifactStore
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ArtifactStore
impl Debug for ArtifactStore
Source§impl Default for ArtifactStore
impl Default for ArtifactStore
Source§fn default() -> ArtifactStore
fn default() -> ArtifactStore
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ArtifactStore
impl !RefUnwindSafe for ArtifactStore
impl Send for ArtifactStore
impl Sync for ArtifactStore
impl Unpin for ArtifactStore
impl UnsafeUnpin for ArtifactStore
impl !UnwindSafe for ArtifactStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more