pub struct Store { /* private fields */ }Expand description
Local artifact store. Thread-safe via internal RwLock.
Artifacts are stored as <artifact_id>.json files.
Content-addressed IDs mean same content → same filename → idempotent writes.
An index.json tracks all artifact IDs for O(1) listing.
Implementations§
Source§impl Store
impl Store
Sourcepub fn open(dir: impl AsRef<Path>) -> Result<Self, StorageError>
pub fn open(dir: impl AsRef<Path>) -> Result<Self, StorageError>
Opens or creates an artifact store at dir.
Sourcepub fn write(&self, record: &Record) -> Result<(), StorageError>
pub fn write(&self, record: &Record) -> Result<(), StorageError>
Writes an artifact record. Idempotent: writing the same artifact twice has no effect beyond overwriting with identical content.
Sourcepub fn exists(&self, id: &str) -> bool
pub fn exists(&self, id: &str) -> bool
Returns true if an artifact with this ID is stored locally.
Sourcepub fn list(&self) -> Vec<IndexEntry>
pub fn list(&self) -> Vec<IndexEntry>
Lists index entries, most recent first.
Sourcepub fn list_by_type(&self, payload_type: &str) -> Vec<IndexEntry>
pub fn list_by_type(&self, payload_type: &str) -> Vec<IndexEntry>
Lists index entries filtered to a specific payload type.
Sourcepub fn set_hub_url(&self, id: &str, hub_url: &str) -> Result<(), StorageError>
pub fn set_hub_url(&self, id: &str, hub_url: &str) -> Result<(), StorageError>
Updates the hub_url on a stored record after a successful dock push.
Sourcepub fn latest(&self) -> Option<IndexEntry>
pub fn latest(&self) -> Option<IndexEntry>
Returns the most recently stored artifact, if any.
Auto Trait Implementations§
impl Freeze for Store
impl RefUnwindSafe for Store
impl Send for Store
impl Sync for Store
impl Unpin for Store
impl UnsafeUnpin for Store
impl UnwindSafe for Store
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