Struct tvix_glue::known_paths::KnownPaths
source · pub struct KnownPaths {
derivations: HashMap<StorePath<String>, ([u8; 32], Derivation)>,
outputs_to_drvpath: HashMap<StorePath<String>, StorePath<String>>,
outputs_to_fetches: HashMap<StorePath<String>, (String, Fetch)>,
}
Expand description
Struct keeping track of all known Derivations in the current evaluation. This keeps both the Derivation struct, as well as the “Hash derivation modulo”.
Fields§
§derivations: HashMap<StorePath<String>, ([u8; 32], Derivation)>
All known derivation or FOD hashes.
Keys are derivation paths, values are a tuple of the “hash derivation modulo” and the Derivation struct itself.
outputs_to_drvpath: HashMap<StorePath<String>, StorePath<String>>
A map from output path to (one) drv path. Note that in the case of FODs, multiple drvs can produce the same output path. We use one of them.
outputs_to_fetches: HashMap<StorePath<String>, (String, Fetch)>
A map from output path to fetches (and their names).
Implementations§
source§impl KnownPaths
impl KnownPaths
sourcepub fn get_hash_derivation_modulo(
&self,
drv_path: &StorePath<String>,
) -> Option<&[u8; 32]>
pub fn get_hash_derivation_modulo( &self, drv_path: &StorePath<String>, ) -> Option<&[u8; 32]>
Fetch the opaque “hash derivation modulo” for a given derivation path.
sourcepub fn get_drv_by_drvpath(
&self,
drv_path: &StorePath<String>,
) -> Option<&Derivation>
pub fn get_drv_by_drvpath( &self, drv_path: &StorePath<String>, ) -> Option<&Derivation>
Return a reference to the Derivation for a given drv path.
sourcepub fn get_drv_path_for_output_path(
&self,
output_path: &StorePath<String>,
) -> Option<&StorePath<String>>
pub fn get_drv_path_for_output_path( &self, output_path: &StorePath<String>, ) -> Option<&StorePath<String>>
Return the drv path of the derivation producing the passed output path. Note there can be multiple Derivations producing the same output path in flight; this function will only return one of them.
sourcepub fn add_derivation(&mut self, drv_path: StorePath<String>, drv: Derivation)
pub fn add_derivation(&mut self, drv_path: StorePath<String>, drv: Derivation)
Insert a new Derivation into this struct. The Derivation struct must pass validation, and its output paths need to be fully calculated. All input derivations this refers to must also be inserted to this struct.
sourcepub fn add_fetch<'a>(
&mut self,
fetch: Fetch,
name: &'a str,
) -> Result<StorePathRef<'a>, BuildStorePathError>
pub fn add_fetch<'a>( &mut self, fetch: Fetch, name: &'a str, ) -> Result<StorePathRef<'a>, BuildStorePathError>
Insert a new Fetch into this struct, which must have an expected hash (otherwise we wouldn’t be able to calculate the store path). Fetches without a known hash need to be fetched inside builtins.
sourcepub fn get_fetch_for_output_path(
&self,
output_path: &StorePath<String>,
) -> Option<(String, Fetch)>
pub fn get_fetch_for_output_path( &self, output_path: &StorePath<String>, ) -> Option<(String, Fetch)>
Return the name and fetch producing the passed output path. Note there can also be (multiple) Derivations producing the same output path.
sourcepub fn get_derivations(
&self,
) -> impl Iterator<Item = (&StorePath<String>, &Derivation)>
pub fn get_derivations( &self, ) -> impl Iterator<Item = (&StorePath<String>, &Derivation)>
Returns an iterator over all known derivations and their store path.
Trait Implementations§
source§impl Debug for KnownPaths
impl Debug for KnownPaths
source§impl Default for KnownPaths
impl Default for KnownPaths
source§fn default() -> KnownPaths
fn default() -> KnownPaths
Auto Trait Implementations§
impl Freeze for KnownPaths
impl RefUnwindSafe for KnownPaths
impl Send for KnownPaths
impl Sync for KnownPaths
impl Unpin for KnownPaths
impl UnwindSafe for KnownPaths
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
source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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 moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request