refactor(tvix/[ca]store): rename store composition feature flags

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>
This commit is contained in:
Florian Klink 2024-11-09 13:33:24 +00:00 committed by flokli
parent d505f03e00
commit e71a857ec8
8 changed files with 20 additions and 22 deletions

View file

@ -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";

View file

@ -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

View file

@ -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 = ''

View file

@ -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 {

View file

@ -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

View file

@ -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

View file

@ -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 = ''

View file

@ -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(&REG, || toml::from_str(&conf_text))?);