From 42dc18353d99453bc0f83492f9f5bc4796f4cc4c Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Tue, 18 Jul 2023 21:34:52 +0300 Subject: feat(tvix/nix-compat): have StorePath accept bytes The primary constructor for this is now from_bytes, from_string is simply calling .as_bytes() on the string, passing it along. The InvalidName error now contains a Vec, to encode the invalid name (which might not be a string anymore). from_absolute_path now accepts a &[u8] (even though we might want to make this a OSString of some sort). StorePath::validate_name has been degraded to a pub(crate) function. It's still used in src/derivation, even though it probably shouldn't at all - that cleanup is left for cl/8412 though. Change-Id: I6b4e62a6fa5c4bec13b535279e73444f0b83ad35 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8973 Autosubmit: flokli Tested-by: BuildkiteCI Reviewed-by: raitobezarius --- tvix/store/src/fuse/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tvix/store/src/fuse/mod.rs') diff --git a/tvix/store/src/fuse/mod.rs b/tvix/store/src/fuse/mod.rs index a357890f59e3..8aa49c499774 100644 --- a/tvix/store/src/fuse/mod.rs +++ b/tvix/store/src/fuse/mod.rs @@ -19,6 +19,7 @@ use crate::{ use fuser::{FileAttr, ReplyAttr, Request}; use nix_compat::store_path::StorePath; use std::io::Read; +use std::str::FromStr; use std::sync::Arc; use std::{collections::HashMap, time::Duration}; use tracing::{debug, info_span, warn}; @@ -99,7 +100,7 @@ impl FUSE { ) -> Result)>, Error> { // parse the name into a [StorePath]. let store_path = if let Some(name) = name.to_str() { - match StorePath::from_string(name) { + match StorePath::from_str(name) { Ok(store_path) => store_path, Err(e) => { debug!(e=?e, "unable to parse as store path"); -- cgit 1.4.1