pub trait ArtifactStore:
Send
+ Sync
+ 'static {
// Required methods
fn load_all(&self) -> Result<Vec<(ArtifactKey, StoredArtifact)>>;
fn load(&self, key: &ArtifactKey) -> Result<Option<StoredArtifact>>;
fn store(
&self,
key: &ArtifactKey,
manifest: &ArtifactManifest,
dylib_bytes: &[u8],
) -> Result<()>;
fn delete(&self, key: &ArtifactKey) -> Result<()>;
fn clear(&self) -> Result<()>;
}Expand description
Trait for loading and storing compiled artifacts.
Implementations manage artifact files on the filesystem. The store owns the dylib files and returns paths to them. The backend loads shared libraries directly from these paths.
Required Methods§
Sourcefn load_all(&self) -> Result<Vec<(ArtifactKey, StoredArtifact)>>
fn load_all(&self) -> Result<Vec<(ArtifactKey, StoredArtifact)>>
Loads all available artifacts from storage.
Sourcefn load(&self, key: &ArtifactKey) -> Result<Option<StoredArtifact>>
fn load(&self, key: &ArtifactKey) -> Result<Option<StoredArtifact>>
Loads a single artifact by key.
Sourcefn store(
&self,
key: &ArtifactKey,
manifest: &ArtifactManifest,
dylib_bytes: &[u8],
) -> Result<()>
fn store( &self, key: &ArtifactKey, manifest: &ArtifactManifest, dylib_bytes: &[u8], ) -> Result<()>
Stores an artifact. The dylib_bytes are the raw shared-library bytes to persist.
The store writes them to disk and the returned path (via subsequent load) points there.
Sourcefn delete(&self, key: &ArtifactKey) -> Result<()>
fn delete(&self, key: &ArtifactKey) -> Result<()>
Deletes an artifact by key.