Skip to main content

LayerCatalog

Struct LayerCatalog 

Source
pub struct LayerCatalog {
    pub version: u32,
    pub entries: HashMap<String, CatalogEntry>,
}
Expand description

Maps conda package builds to their reproducible OCI layer digest.

Key format: “name==version-build” (e.g. “openssl==3.3.0-h69704a7_0”).

Because bv-builder produces bit-identical compressed layer blobs for the same package triple (SOURCE_DATE_EPOCH + sorted entries + zstd level 19), the digest here is not a cache hint — it is a stable identity. Any future build of the same package will produce the same bytes and therefore the same blob on the registry. Docker/OCI registries deduplicate by content digest, so two images that both contain “openssl==3.3.0” share exactly one copy of that layer on disk and on the wire.

The catalog is stored in the registry repo at layers/catalog.json and grows incrementally as new tools are published via bv publish --spec. It replaces the batch-computed popularity.json for user-side publishing: instead of requiring a full scan of all registry specs, each new tool greedily adds its solo layers to the catalog, and future builds inherit the benefit automatically.

Fields§

§version: u32§entries: HashMap<String, CatalogEntry>

Implementations§

Source§

impl LayerCatalog

Source

pub fn new() -> Self

Source

pub fn key(name: &str, version: &str, build: &str) -> String

Source

pub fn get( &self, name: &str, version: &str, build: &str, ) -> Option<&CatalogEntry>

Source

pub fn contains(&self, name: &str, version: &str, build: &str) -> bool

Source

pub fn record(&mut self, name: &str, version: &str, build: &str, digest: &str)

Record a solo layer for this package. If the entry already exists the count is incremented and the digest is updated (same package triple always produces the same digest, so the update is a no-op in practice).

Source

pub fn load(path: &Path) -> Result<Self>

Source

pub fn save(&self, path: &Path) -> Result<()>

Source

pub fn to_json(&self) -> Result<String>

Trait Implementations§

Source§

impl Clone for LayerCatalog

Source§

fn clone(&self) -> LayerCatalog

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LayerCatalog

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for LayerCatalog

Source§

fn default() -> LayerCatalog

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for LayerCatalog

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for LayerCatalog

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more