diff options
author | Florian Klink <flokli@flokli.de> | 2024-11-09T13·33+0000 |
---|---|---|
committer | flokli <flokli@flokli.de> | 2024-11-11T18·46+0000 |
commit | e71a857ec892f14ee7ce318f6753ba4af8d5ca4e (patch) | |
tree | 9a71fce982ec64c8f7dd8484722fe31fd6785446 /tvix | |
parent | d505f03e005b87d315694a22a75c11205266ba7d (diff) |
refactor(tvix/[ca]store): rename store composition feature flags r/8900
tvix-castore already supports composition without any additional feature flags, the only thing that can be explicitly enabled is referring to other stores via an anonymous url. Rename that feature flag to "xp-composition-url-refs". tvix-store effectively only controls the CLI surface, so rename this to "xp-composition-cli". The "store" in the feature name was dropped, as it's already apparent from being in the tvix-[ca]store crate. Change-Id: I1175dc6280cbba4cbcdfb7fd4b35fce713b45fc4 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12747 Tested-by: BuildkiteCI Reviewed-by: yuka <yuka@yuka.dev>
Diffstat (limited to 'tvix')
-rw-r--r-- | tvix/Cargo.nix | 6 | ||||
-rw-r--r-- | tvix/castore/Cargo.toml | 8 | ||||
-rw-r--r-- | tvix/castore/default.nix | 2 | ||||
-rw-r--r-- | tvix/castore/src/composition.rs | 6 | ||||
-rw-r--r-- | tvix/castore/src/directoryservice/from_addr.rs | 4 | ||||
-rw-r--r-- | tvix/store/Cargo.toml | 2 | ||||
-rw-r--r-- | tvix/store/default.nix | 2 | ||||
-rw-r--r-- | tvix/store/src/utils.rs | 12 |
8 files changed, 20 insertions, 22 deletions
diff --git a/tvix/Cargo.nix b/tvix/Cargo.nix index a09cbc016a23..ed9132ebf5bb 100644 --- a/tvix/Cargo.nix +++ b/tvix/Cargo.nix @@ -15507,7 +15507,7 @@ rec { "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 = [ "cloud" "default" "fs" "fuse" "integration" "tonic-reflection" "virtiofs" "xp-store-composition" ]; + resolvedDefaultFeatures = [ "cloud" "default" "fs" "fuse" "integration" "tonic-reflection" "virtiofs" "xp-composition-url-refs" ]; }; "tvix-cli" = rec { crateName = "tvix-cli"; @@ -16260,9 +16260,9 @@ rec { "tonic-reflection" = [ "dep:tonic-reflection" "tvix-castore/tonic-reflection" ]; "tracy" = [ "tvix-tracing/tracy" ]; "virtiofs" = [ "tvix-castore/virtiofs" ]; - "xp-store-composition" = [ "toml" "tvix-castore/xp-store-composition" ]; + "xp-composition-cli" = [ "toml" "tvix-castore/xp-composition-url-refs" ]; }; - resolvedDefaultFeatures = [ "cloud" "default" "fuse" "integration" "otlp" "toml" "tonic-reflection" "tracy" "virtiofs" "xp-store-composition" ]; + resolvedDefaultFeatures = [ "cloud" "default" "fuse" "integration" "otlp" "toml" "tonic-reflection" "tracy" "virtiofs" "xp-composition-cli" ]; }; "tvix-tracing" = rec { crateName = "tvix-tracing"; diff --git a/tvix/castore/Cargo.toml b/tvix/castore/Cargo.toml index aa44e2e8ee4b..3c32e5f05229 100644 --- a/tvix/castore/Cargo.toml +++ b/tvix/castore/Cargo.toml @@ -91,11 +91,9 @@ virtiofs = [ ] fuse = ["fs"] tonic-reflection = ["dep:tonic-reflection"] -# It's already possible for other crates to build a -# fully fledged store composition system based on castore composition. -# However, this feature enables anonymous url syntax which might -# inherently expose arbitrary composition possibilities to the user. -xp-store-composition = [] +# This feature enables anonymous url syntax which might inherently expose +# arbitrary composition possibilities to the user. +xp-composition-url-refs = [] # Whether to run the integration tests. # Requires the following packages in $PATH: # cbtemulator, google-cloud-bigtable-tool diff --git a/tvix/castore/default.nix b/tvix/castore/default.nix index 5314da9e0333..47c9a99980b8 100644 --- a/tvix/castore/default.nix +++ b/tvix/castore/default.nix @@ -9,7 +9,7 @@ meta.ci.targets = [ "integration-tests" ] ++ lib.filter (x: lib.hasPrefix "with-features" x || x == "no-features") (lib.attrNames passthru); passthru = (depot.tvix.utils.mkFeaturePowerset { inherit (old) crateName; - features = ([ "cloud" "fuse" "tonic-reflection" "xp-store-composition" ] + features = ([ "cloud" "fuse" "tonic-reflection" "xp-composition-url-refs" ] # virtiofs feature currently fails to build on Darwin ++ lib.optional pkgs.stdenv.isLinux "virtiofs"); override.testPreRun = '' diff --git a/tvix/castore/src/composition.rs b/tvix/castore/src/composition.rs index c6fa1ce64ac4..c3b6222d5d86 100644 --- a/tvix/castore/src/composition.rs +++ b/tvix/castore/src/composition.rs @@ -89,7 +89,7 @@ //! //! Continue with Example 2, with my_registry instead of REG //! -//! EXPERIMENTAL: If the xp-store-composition feature is enabled, +//! EXPERIMENTAL: If the xp-composition-url-refs feature is enabled, //! entrypoints can also be URL strings, which are created as //! anonymous stores. Instantiations of the same URL will //! result in a new, distinct anonymous store each time, so creating @@ -315,7 +315,7 @@ impl<'a> CompositionContext<'a> { Ok(self.build_internal(entrypoint).await?) } - #[cfg(feature = "xp-store-composition")] + #[cfg(feature = "xp-composition-url-refs")] async fn build_anonymous<T: ?Sized + Send + Sync + 'static>( &self, entrypoint: String, @@ -330,7 +330,7 @@ impl<'a> CompositionContext<'a> { &self, entrypoint: String, ) -> BoxFuture<'_, Result<Arc<T>, CompositionError>> { - #[cfg(feature = "xp-store-composition")] + #[cfg(feature = "xp-composition-url-refs")] if entrypoint.contains("://") { // There is a chance this is a url. we are building an anonymous store return Box::pin(async move { diff --git a/tvix/castore/src/directoryservice/from_addr.rs b/tvix/castore/src/directoryservice/from_addr.rs index 2f7fc6d7de5a..d50b5a35dd03 100644 --- a/tvix/castore/src/directoryservice/from_addr.rs +++ b/tvix/castore/src/directoryservice/from_addr.rs @@ -89,12 +89,12 @@ mod tests { #[case::grpc_invalid_host_and_path("grpc+http://localhost/some-path", false)] /// A valid example for store composition using anonymous urls #[cfg_attr( - feature = "xp-store-composition", + feature = "xp-composition-url-refs", case::anonymous_url_composition("cache://?near=memory://&far=memory://", true) )] /// Store composition with anonymous urls should fail if the feature is disabled #[cfg_attr( - not(feature = "xp-store-composition"), + not(feature = "xp-composition-url-refs"), case::anonymous_url_composition("cache://?near=memory://&far=memory://", false) )] /// A valid example for Bigtable diff --git a/tvix/store/Cargo.toml b/tvix/store/Cargo.toml index 865b1f4f61b9..22a7cf19f087 100644 --- a/tvix/store/Cargo.toml +++ b/tvix/store/Cargo.toml @@ -73,7 +73,7 @@ otlp = ["tvix-tracing/otlp"] tonic-reflection = ["dep:tonic-reflection", "tvix-castore/tonic-reflection"] tracy = ["tvix-tracing/tracy"] virtiofs = ["tvix-castore/virtiofs"] -xp-store-composition = ["toml", "tvix-castore/xp-store-composition"] +xp-composition-cli = ["toml", "tvix-castore/xp-composition-url-refs"] # Whether to run the integration tests. # Requires the following packages in $PATH: # cbtemulator, google-cloud-bigtable-tool diff --git a/tvix/store/default.nix b/tvix/store/default.nix index 863ddb6de23f..58749025ddb4 100644 --- a/tvix/store/default.nix +++ b/tvix/store/default.nix @@ -37,7 +37,7 @@ in }; passthru = old.passthru // (depot.tvix.utils.mkFeaturePowerset { inherit (old) crateName; - features = ([ "cloud" "fuse" "otlp" "tonic-reflection" "xp-store-composition" ] + features = ([ "cloud" "fuse" "otlp" "tonic-reflection" "xp-composition-cli" ] # virtiofs feature currently fails to build on Darwin ++ lib.optional pkgs.stdenv.isLinux "virtiofs"); override.testPreRun = '' diff --git a/tvix/store/src/utils.rs b/tvix/store/src/utils.rs index 49b23bc6b5f3..0a1888f6f2e1 100644 --- a/tvix/store/src/utils.rs +++ b/tvix/store/src/utils.rs @@ -55,7 +55,7 @@ pub struct ServiceUrls { /// Path to a TOML file describing the way the services should be composed /// Experimental because the format is not final. /// If specified, the other service addrs are ignored. - #[cfg(feature = "xp-store-composition")] + #[cfg(feature = "xp-composition-cli")] #[arg(long, env)] experimental_store_composition: Option<String>, } @@ -75,7 +75,7 @@ pub struct ServiceUrlsGrpc { #[arg(long, env, default_value = "grpc+http://[::1]:8000")] path_info_service_addr: String, - #[cfg(feature = "xp-store-composition")] + #[cfg(feature = "xp-composition-cli")] #[arg(long, env)] experimental_store_composition: Option<String>, } @@ -98,7 +98,7 @@ pub struct ServiceUrlsMemory { #[arg(long, env, default_value = "memory://")] path_info_service_addr: String, - #[cfg(feature = "xp-store-composition")] + #[cfg(feature = "xp-composition-cli")] #[arg(long, env)] experimental_store_composition: Option<String>, } @@ -109,7 +109,7 @@ impl From<ServiceUrlsGrpc> for ServiceUrls { blob_service_addr: urls.blob_service_addr, directory_service_addr: urls.directory_service_addr, path_info_service_addr: urls.path_info_service_addr, - #[cfg(feature = "xp-store-composition")] + #[cfg(feature = "xp-composition-cli")] experimental_store_composition: urls.experimental_store_composition, } } @@ -121,7 +121,7 @@ impl From<ServiceUrlsMemory> for ServiceUrls { blob_service_addr: urls.blob_service_addr, directory_service_addr: urls.directory_service_addr, path_info_service_addr: urls.path_info_service_addr, - #[cfg(feature = "xp-store-composition")] + #[cfg(feature = "xp-composition-cli")] experimental_store_composition: urls.experimental_store_composition, } } @@ -132,7 +132,7 @@ pub async fn addrs_to_configs( ) -> Result<CompositionConfigs, Box<dyn std::error::Error + Send + Sync>> { let urls: ServiceUrls = urls.into(); - #[cfg(feature = "xp-store-composition")] + #[cfg(feature = "xp-composition-cli")] if let Some(conf_path) = urls.experimental_store_composition { let conf_text = tokio::fs::read_to_string(conf_path).await?; return Ok(with_registry(®, || toml::from_str(&conf_text))?); |