pub struct Catalog { /* private fields */ }Expand description
A local block catalog rooted at a directory. This type has no opinion
about environment variables or home directories — the caller (the CLI)
decides where root points.
Implementations§
Source§impl Catalog
impl Catalog
Sourcepub fn open(root: impl Into<PathBuf>) -> Self
pub fn open(root: impl Into<PathBuf>) -> Self
Open (without yet creating on disk) a catalog rooted at root.
Sourcepub fn add(
&self,
name_version: &str,
artifact_path: &Path,
engine: &Engine,
) -> Result<AddOutcome, CatalogError>
pub fn add( &self, name_version: &str, artifact_path: &Path, engine: &Engine, ) -> Result<AddOutcome, CatalogError>
Catalog the artifact at artifact_path under name_version.
engine is only used if the artifact turns out to be a wasm block —
a bundle’s signature is read straight from its own manifest, never
wasm-instantiated (bundle bytes are a custom container, not a wasm
module; instantiating them would simply fail to parse).
Sourcepub fn list(&self) -> Result<Vec<(String, Entry)>, CatalogError>
pub fn list(&self) -> Result<Vec<(String, Entry)>, CatalogError>
List every cataloged entry, in deterministic (sorted-by-name@version) order.
Sourcepub fn show(&self, name_version: &str) -> Result<Entry, CatalogError>
pub fn show(&self, name_version: &str) -> Result<Entry, CatalogError>
Look up one entry’s cached Entry by exact, case-sensitive
name@version — a catalog name is an opaque string, like a version is;
no case-folding, no normalization.
Sourcepub fn read_blob(&self, entry: &Entry) -> Result<Vec<u8>, CatalogError>
pub fn read_blob(&self, entry: &Entry) -> Result<Vec<u8>, CatalogError>
Read an entry’s raw bytes back out of the blob store. The catalog’s
only way to get from an Entry to actual artifact bytes — blobs/
stays an implementation detail, same as add() already hides
write_blob.
Sourcepub fn rm(&self, name_version: &str) -> Result<(), CatalogError>
pub fn rm(&self, name_version: &str) -> Result<(), CatalogError>
Remove a name@version from the index. The blob it pointed at is left on
disk — no garbage collection in v1 (an orphaned blob is wasted space, not
a correctness problem; see the design doc).
Sourcepub fn resolve(
&self,
s: &str,
context: ResolutionContext,
) -> Result<Resolved, CatalogError>
pub fn resolve( &self, s: &str, context: ResolutionContext, ) -> Result<Resolved, CatalogError>
Resolve one pipeline entry string per the catalog spec’s three-step
algorithm: direct path/.wasm/.cfbundle first, then an exact
catalog lookup if @version is present, then latest-by-created_at
if it’s not and context allows an unqualified name.
A compiled-artifact suffix (.wasm or .cfbundle) is always treated
as Direct, even when nothing actually exists at that path — a
genuinely missing artifact should fail with a clear “no such file”,
not be silently reinterpreted as a catalog name that happens to
contain a . in it. Both suffixes get identical treatment here:
pipeline::resolve_and_load’s own decision to prefer a joined path
for one of these suffixes (even before checking existence) is only
correct if this function honors the same suffixes the same way.
Auto Trait Implementations§
impl Freeze for Catalog
impl RefUnwindSafe for Catalog
impl Send for Catalog
impl Sync for Catalog
impl Unpin for Catalog
impl UnsafeUnpin for Catalog
impl UnwindSafe for Catalog
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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> ⓘ
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