pub struct ArtifactStore { /* private fields */ }Expand description
Content-addressed artifact store using BLAKE3 hashes.
Thread-safe via DashMap. The store guarantees:
- Deduplication: same content always produces the same hash.
- Integrity: every load verifies the content hash.
- Reference counting: tracks how many consumers reference each artifact.
Implementations§
Source§impl ArtifactStore
impl ArtifactStore
Sourcepub fn new_memory() -> Self
pub fn new_memory() -> Self
Create a new in-memory artifact store.
Sourcepub fn store(
&self,
content: &[u8],
content_type: ArtifactType,
) -> Result<String, KernelError>
pub fn store( &self, content: &[u8], content_type: ArtifactType, ) -> Result<String, KernelError>
Store content and return the BLAKE3 hash.
If the content is already stored, increments the reference count and returns the existing hash (deduplication).
Sourcepub fn load(&self, hash: &str) -> Result<Vec<u8>, KernelError>
pub fn load(&self, hash: &str) -> Result<Vec<u8>, KernelError>
Load content by hash, verifying integrity on read.
Sourcepub fn release(&self, hash: &str) -> bool
pub fn release(&self, hash: &str) -> bool
Decrement the reference count for an artifact.
Returns true if the reference count reached zero (eligible for GC).
Sourcepub fn remove(&self, hash: &str) -> Result<(), KernelError>
pub fn remove(&self, hash: &str) -> Result<(), KernelError>
Remove an artifact and its data from storage.
Sourcepub fn total_bytes(&self) -> u64
pub fn total_bytes(&self) -> u64
Total stored bytes.
Trait Implementations§
Source§impl SystemService for ArtifactStore
impl SystemService for ArtifactStore
Source§fn service_type(&self) -> ServiceType
fn service_type(&self) -> ServiceType
Service type category.
Source§fn start<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn start<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Start the service.
Source§fn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Stop the service.
Source§fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = HealthStatus> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = HealthStatus> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Perform a health check.
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more