about summary refs log tree commit diff
path: root/tvix/store
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-01-17T11·39+0100
committerflokli <flokli@flokli.de>2023-01-18T17·13+0000
commit0f7e4bec6671d6b91c62b2b82c699211f2000622 (patch)
tree4a030a7b93f111ca6d18e652725f36308254ec0b /tvix/store
parent6e7f06d942a5e54d20d4441ff196ce3ffc99855a (diff)
feat(tvix/store): rename and expose StorePath::validate_name r/5697
Change-Id: I8a16c214c7c644756d9d54187beba8c80ccfb39c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7853
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/store')
-rw-r--r--tvix/store/src/store_path.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/tvix/store/src/store_path.rs b/tvix/store/src/store_path.rs
index 925a0b4ccff2..f437edb6b2d8 100644
--- a/tvix/store/src/store_path.rs
+++ b/tvix/store/src/store_path.rs
@@ -64,7 +64,7 @@ impl StorePath {
             return Err(ParseStorePathError::MissingDash());
         }
 
-        StorePath::validate_characters(&s[ENCODED_DIGEST_SIZE + 2..])?;
+        StorePath::validate_name(&s[ENCODED_DIGEST_SIZE + 2..])?;
 
         Ok(StorePath {
             name: s[ENCODED_DIGEST_SIZE + 1..].to_string(),
@@ -87,7 +87,8 @@ impl StorePath {
         format!("{}/{}", STORE_DIR, self)
     }
 
-    fn validate_characters(s: &str) -> Result<(), ParseStorePathError> {
+    /// Checks a given &str to match the restrictions for store path names.
+    pub fn validate_name(s: &str) -> Result<(), ParseStorePathError> {
         for c in s.chars() {
             if c.is_ascii_alphanumeric()
                 || c == '-'