about summary refs log tree commit diff
path: root/tvix/store/src/directoryservice/mod.rs
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-06-09T20·35+0300
committerclbot <clbot@tvl.fyi>2023-06-14T23·15+0000
commitbb7c76739a30d2f312693799d8237eb0eb2da28d (patch)
tree99a849fe4c8d2fee7e8ba49504c192607ad1128f /tvix/store/src/directoryservice/mod.rs
parenta1acb5bcb301bd599d97909abebcda6235421dc4 (diff)
feat(tvix/store/directorysvc): add from_addr r/6303
Add --directory-service-addr arg to tvix-store CLI.

Change-Id: Iea1e6f08f27f7157b21ccf397297c68358bd78a0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8743
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: tazjin <tazjin@tvl.su>
Diffstat (limited to 'tvix/store/src/directoryservice/mod.rs')
-rw-r--r--tvix/store/src/directoryservice/mod.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/tvix/store/src/directoryservice/mod.rs b/tvix/store/src/directoryservice/mod.rs
index 6589a5b62599..c99848c551fd 100644
--- a/tvix/store/src/directoryservice/mod.rs
+++ b/tvix/store/src/directoryservice/mod.rs
@@ -1,10 +1,13 @@
 use crate::{proto, B3Digest, Error};
+
+mod from_addr;
 mod grpc;
 mod memory;
 mod sled;
 mod traverse;
 mod utils;
 
+pub use self::from_addr::from_addr;
 pub use self::grpc::GRPCDirectoryService;
 pub use self::memory::MemoryDirectoryService;
 pub use self::sled::SledDirectoryService;
@@ -15,6 +18,11 @@ pub use self::utils::DirectoryTraverser;
 /// This is a simple get and put of [crate::proto::Directory], returning their
 /// digest.
 pub trait DirectoryService: Send + Sync {
+    /// Create a new instance by passing in a connection URL.
+    fn from_url(url: &url::Url) -> Result<Self, Error>
+    where
+        Self: Sized;
+
     /// Get looks up a single Directory message by its digest.
     /// In case the directory is not found, Ok(None) is returned.
     fn get(&self, digest: &B3Digest) -> Result<Option<proto::Directory>, Error>;