about summary refs log tree commit diff
path: root/tvix/store/src/pathinfoservice
diff options
context:
space:
mode:
authorYureka <tvl@yuka.dev>2024-08-07T14·50+0200
committeryuka <tvl@yuka.dev>2024-10-10T12·53+0000
commit52bb3c6d025b2e1a2c2ec33fbb0e70f760b68253 (patch)
tree95c9625802bce157c77f25199078bdaaae020516 /tvix/store/src/pathinfoservice
parentba4e02c3ac1e5ff093268874e5dc684596e9f541 (diff)
feat(tvix/composition): allow urls as anonymous stores r/8785
This allows specifying an url in place of a named reference to another
composition entry, if the castore crate has been compiled with the
 xp-store-composition feature.

Example: `--directory-service-addr cache://?near=memory://&far=memory://`

This would be equivalent to the instantiation via toml file:

```toml
[memory1]
type = "memory"

[memory2]
type = "memory"

[default]
type = "cache"
near = "memory1"
far = "memory2"
```

Note that each anonymous url causes a distinct instance to be created.

Change-Id: Iee5a07a94b063b5e767c704d9cad0114fa843164
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12146
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/store/src/pathinfoservice')
-rw-r--r--tvix/store/src/pathinfoservice/from_addr.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/tvix/store/src/pathinfoservice/from_addr.rs b/tvix/store/src/pathinfoservice/from_addr.rs
index b2e8b473934a..3dfb08c9e817 100644
--- a/tvix/store/src/pathinfoservice/from_addr.rs
+++ b/tvix/store/src/pathinfoservice/from_addr.rs
@@ -44,7 +44,10 @@ pub async fn from_addr(
     })?
     .0;
     let path_info_service = path_info_service_config
-        .build("anonymous", context.unwrap_or(&CompositionContext::blank()))
+        .build(
+            "anonymous",
+            context.unwrap_or(&CompositionContext::blank(&REG)),
+        )
         .await?;
 
     Ok(path_info_service)
@@ -53,7 +56,7 @@ pub async fn from_addr(
 #[cfg(test)]
 mod tests {
     use super::from_addr;
-    use crate::composition::{Composition, DeserializeWithRegistry, ServiceBuilder};
+    use crate::composition::{Composition, DeserializeWithRegistry, ServiceBuilder, REG};
     use lazy_static::lazy_static;
     use rstest::rstest;
     use tempfile::TempDir;
@@ -125,7 +128,7 @@ mod tests {
     )]
     #[tokio::test]
     async fn test_from_addr_tokio(#[case] uri_str: &str, #[case] exp_succeed: bool) {
-        let mut comp = Composition::default();
+        let mut comp = Composition::new(&REG);
         comp.extend(vec![(
             "default".into(),
             DeserializeWithRegistry(Box::new(MemoryBlobServiceConfig {})