pub struct Registry { /* private fields */ }Expand description
The registry.
Implementations§
Source§impl Registry
impl Registry
Sourcepub fn register(
&self,
name: &RawStr,
cab: Cab,
meter: &Arc<Meter>,
) -> Result<(), Error>
pub fn register( &self, name: &RawStr, cab: Cab, meter: &Arc<Meter>, ) -> Result<(), Error>
register_cab(name, cab) for a file the caller loaded, as a load of
its own, charged to meter (module docs). The slot holds cab, so it
is never evicted: cab is a file on a caller’s input meter
(crate::budget::Reservation::Input), not one the Environment
loaded as a dependency, which its load registered already, and
whose reads through such a slot would charge the dependency pool
outside the Environment’s retry (plan section 3.13).
Sourcepub fn register_lazy(
&self,
name: &RawStr,
bundle: Arc<BundleFile>,
dir_index: usize,
meter: &Arc<Meter>,
) -> Result<(), Error>
pub fn register_lazy( &self, name: &RawStr, bundle: Arc<BundleFile>, dir_index: usize, meter: &Arc<Meter>, ) -> Result<(), Error>
Registers entry dir_index of a bundle the caller loaded Lazy, as a
load of its own, to parse on first use; charged to meter. As for
Self::register, bundle is on a caller’s input meter, not a
dependency’s.
Source§impl Registry
impl Registry
Sourcepub fn get(
&self,
name: &RawStr,
meter: &Arc<Meter>,
) -> Result<Option<Cab>, Error>
pub fn get( &self, name: &RawStr, meter: &Arc<Meter>, ) -> Result<Option<Cab>, Error>
get_cab(name), parsing a lazy slot now, or opening an evicted
dependency again from its source. The key is simplify_name(name),
built charged to meter (crate::pystr::simplify_name) and dropped
when the lookup returns; a name already in its simplified form is
looked up as it is, with no copy. The registry holds no LRU, so a
pool refusal of the key’s charge, when meter is a dependency’s, is
returned here as it is: Environment::get_cab is the lookup that
evicts and retries (the registry’s with_room).