diff options
Diffstat (limited to 'tvix/store/src')
-rw-r--r-- | tvix/store/src/proto/mod.rs | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/tvix/store/src/proto/mod.rs b/tvix/store/src/proto/mod.rs index 7921adc4062e..718e24912de1 100644 --- a/tvix/store/src/proto/mod.rs +++ b/tvix/store/src/proto/mod.rs @@ -1,7 +1,7 @@ #![allow(clippy::derive_partial_eq_without_eq, non_snake_case)] use data_encoding::BASE64; // https://github.com/hyperium/tonic/issues/1056 -use nix_compat::store_path::{self, StorePath}; +use nix_compat::store_path; use thiserror::Error; use tvix_castore::proto::{self as castorepb, NamedNode, ValidateNodeError}; @@ -64,13 +64,13 @@ pub enum ValidatePathInfoError { /// Parses a root node name. /// -/// On success, this returns the parsed [StorePath]. +/// On success, this returns the parsed [store_path::StorePath]. /// On error, it returns an error generated from the supplied constructor. fn parse_node_name_root<E>( name: &[u8], err: fn(Vec<u8>, store_path::Error) -> E, -) -> Result<StorePath, E> { - match StorePath::from_bytes(name) { +) -> Result<store_path::StorePath, E> { + match store_path::StorePath::from_bytes(name) { Ok(np) => Ok(np), Err(e) => Err(err(name.to_vec(), e)), } @@ -78,9 +78,9 @@ fn parse_node_name_root<E>( impl PathInfo { /// validate performs some checks on the PathInfo struct, - /// Returning either a [StorePath] of the root node, or a + /// Returning either a [store_path::StorePath] of the root node, or a /// [ValidatePathInfoError]. - pub fn validate(&self) -> Result<StorePath, ValidatePathInfoError> { + pub fn validate(&self) -> Result<store_path::StorePath, ValidatePathInfoError> { // ensure the references have the right number of bytes. for (i, reference) in self.references.iter().enumerate() { if reference.len() != store_path::DIGEST_SIZE { @@ -111,13 +111,15 @@ impl PathInfo { // parse references in reference_names. for (i, reference_name_str) in narinfo.reference_names.iter().enumerate() { // ensure thy parse as (non-absolute) store path - let reference_names_store_path = - StorePath::from_bytes(reference_name_str.as_bytes()).map_err(|_| { - ValidatePathInfoError::InvalidNarinfoReferenceName( - i, - reference_name_str.to_owned(), - ) - })?; + let reference_names_store_path = store_path::StorePath::from_bytes( + reference_name_str.as_bytes(), + ) + .map_err(|_| { + ValidatePathInfoError::InvalidNarinfoReferenceName( + i, + reference_name_str.to_owned(), + ) + })?; // ensure their digest matches the one at self.references[i]. { @@ -137,7 +139,7 @@ impl PathInfo { } } - // Ensure there is a (root) node present, and it properly parses to a [StorePath]. + // Ensure there is a (root) node present, and it properly parses to a [store_path::StorePath]. let root_nix_path = match &self.node { None | Some(castorepb::Node { node: None }) => { Err(ValidatePathInfoError::NoNodePresent())? |