diff options
Diffstat (limited to 'tvix')
-rw-r--r-- | tvix/Cargo.nix | 10 | ||||
-rw-r--r-- | tvix/castore/Cargo.toml | 7 | ||||
-rw-r--r-- | tvix/castore/src/blobservice/from_addr.rs | 22 | ||||
-rw-r--r-- | tvix/store/Cargo.toml | 3 |
4 files changed, 31 insertions, 11 deletions
diff --git a/tvix/Cargo.nix b/tvix/Cargo.nix index 31d6faec252d..d3272843c2f7 100644 --- a/tvix/Cargo.nix +++ b/tvix/Cargo.nix @@ -12117,7 +12117,7 @@ rec { { name = "object_store"; packageId = "object_store"; - features = [ "aws" "azure" "gcp" "http" ]; + features = [ "http" ]; } { name = "parking_lot"; @@ -12243,12 +12243,13 @@ rec { } ]; features = { + "cloud" = [ "object_store/aws" "object_store/azure" "object_store/gcp" ]; "fs" = [ "dep:libc" "dep:fuse-backend-rs" ]; "fuse" = [ "fs" ]; "tonic-reflection" = [ "dep:tonic-reflection" ]; "virtiofs" = [ "fs" "dep:vhost" "dep:vhost-user-backend" "dep:virtio-queue" "dep:vm-memory" "dep:vmm-sys-util" "dep:virtio-bindings" "fuse-backend-rs?/vhost-user-fs" "fuse-backend-rs?/virtiofs" ]; }; - resolvedDefaultFeatures = [ "default" "fs" "fuse" "tonic-reflection" "virtiofs" ]; + resolvedDefaultFeatures = [ "cloud" "default" "fs" "fuse" "tonic-reflection" "virtiofs" ]; }; "tvix-cli" = rec { crateName = "tvix-cli"; @@ -12927,13 +12928,14 @@ rec { } ]; features = { - "default" = [ "fuse" "otlp" "tonic-reflection" ]; + "cloud" = [ "tvix-castore/cloud" ]; + "default" = [ "cloud" "fuse" "otlp" "tonic-reflection" ]; "fuse" = [ "tvix-castore/fuse" ]; "otlp" = [ "dep:opentelemetry" "dep:opentelemetry-otlp" "dep:opentelemetry_sdk" ]; "tonic-reflection" = [ "dep:tonic-reflection" "tvix-castore/tonic-reflection" ]; "virtiofs" = [ "tvix-castore/virtiofs" ]; }; - resolvedDefaultFeatures = [ "default" "fuse" "otlp" "tonic-reflection" "virtiofs" ]; + resolvedDefaultFeatures = [ "cloud" "default" "fuse" "otlp" "tonic-reflection" "virtiofs" ]; }; "typenum" = rec { crateName = "typenum"; diff --git a/tvix/castore/Cargo.toml b/tvix/castore/Cargo.toml index 69834ed2e3b4..0a8b9b415773 100644 --- a/tvix/castore/Cargo.toml +++ b/tvix/castore/Cargo.toml @@ -14,7 +14,7 @@ digest = "0.10.7" fastcdc = { version = "3.1.0", features = ["tokio"] } futures = "0.3.30" lazy_static = "1.4.0" -object_store = { version = "0.9.1", features = ["aws", "azure", "gcp", "http"] } +object_store = { version = "0.9.1", features = ["http"] } parking_lot = "0.12.1" pin-project-lite = "0.2.13" prost = "0.12.1" @@ -78,6 +78,11 @@ hex-literal = "0.4.1" [features] default = [] +cloud = [ + "object_store/aws", + "object_store/azure", + "object_store/gcp", +] fs = ["dep:libc", "dep:fuse-backend-rs"] virtiofs = [ "fs", diff --git a/tvix/castore/src/blobservice/from_addr.rs b/tvix/castore/src/blobservice/from_addr.rs index 6925407552f6..1f37ef61edf6 100644 --- a/tvix/castore/src/blobservice/from_addr.rs +++ b/tvix/castore/src/blobservice/from_addr.rs @@ -131,17 +131,29 @@ mod tests { /// Correct scheme to connect to localhost over http, without specifying a port. #[test_case("grpc+https://localhost", true; "grpc valid https host without port")] /// Correct scheme to connect to localhost over http, but with additional path, which is invalid. - #[test_case("grpc+http://localhost/some-path", false; "grpc valid invalid host and path")] - /// An example for object store (Memory) + #[test_case("grpc+http://localhost/some-path", false; "grpc invalid has path")] + /// An example for object store (InMemory) #[test_case("objectstore+memory:///", true; "objectstore valid memory url")] - /// An example for object store (File) - #[test_case("objectstore+file:///foo/bar", true; "objectstore valid file url")] // ?? + /// An example for object store (LocalFileSystem) + #[test_case("objectstore+file:///foo/bar", true; "objectstore valid file url")] + // An example for object store (HTTP / WebDAV) + #[test_case("objectstore+https://localhost:8080/some-path", true; "objectstore valid http url")] + #[tokio::test] + async fn test_from_addr_tokio(uri_str: &str, exp_succeed: bool) { + if exp_succeed { + from_addr(uri_str).await.expect("should succeed"); + } else { + assert!(from_addr(uri_str).await.is_err(), "should fail"); + } + } + + #[cfg(feature = "cloud")] /// An example for object store (S3) #[test_case("objectstore+s3://bucket/path", true; "objectstore valid s3 url")] /// An example for object store (GCS) #[test_case("objectstore+gs://bucket/path", true; "objectstore valid gcs url")] #[tokio::test] - async fn test_from_addr_tokio(uri_str: &str, exp_succeed: bool) { + async fn test_from_addr_tokio_cloud(uri_str: &str, exp_succeed: bool) { if exp_succeed { from_addr(uri_str).await.expect("should succeed"); } else { diff --git a/tvix/store/Cargo.toml b/tvix/store/Cargo.toml index 366bd3921684..2b93cd7a528c 100644 --- a/tvix/store/Cargo.toml +++ b/tvix/store/Cargo.toml @@ -53,7 +53,8 @@ tempfile = "3.3.0" tokio-retry = "0.3.0" [features] -default = ["fuse", "otlp", "tonic-reflection"] +default = ["cloud", "fuse", "otlp", "tonic-reflection"] +cloud = ["tvix-castore/cloud"] fuse = ["tvix-castore/fuse"] otlp = ["dep:opentelemetry", "dep:opentelemetry-otlp", "dep:opentelemetry_sdk"] tonic-reflection = ["dep:tonic-reflection", "tvix-castore/tonic-reflection"] |