From 4801d6bf85ebb47910dd4bfe9db11846ff438572 Mon Sep 17 00:00:00 2001 From: Yureka Date: Fri, 19 Jul 2024 10:51:05 +0200 Subject: feat(tvix): different service types in one composition This will be necessary for the PathInfoService composition, as some PathInfoService implementations require a BlobService & DirectoryService to ingest into. Using the Extend trait for creating compositions allows extending the same composition with configs of various types e.g. BlobStore, DirectoryStore Generics are moved from the Composition struct to the functions.The storage of the InstantiatonStates uses the TypeId in the key and a Box in the value, which is downcasted to InstantiatonState. Change-Id: I2af11f26c535029adfb1c62905e0e7c4aaed7b51 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11980 Reviewed-by: flokli Reviewed-by: raitobezarius Tested-by: BuildkiteCI Autosubmit: yuka --- tvix/castore/src/directoryservice/bigtable.rs | 2 +- tvix/castore/src/directoryservice/combinators.rs | 2 +- tvix/castore/src/directoryservice/grpc.rs | 2 +- tvix/castore/src/directoryservice/memory.rs | 2 +- tvix/castore/src/directoryservice/object_store.rs | 2 +- tvix/castore/src/directoryservice/sled.rs | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 'tvix/castore/src/directoryservice') diff --git a/tvix/castore/src/directoryservice/bigtable.rs b/tvix/castore/src/directoryservice/bigtable.rs index 596094930614..d10dddaf9f60 100644 --- a/tvix/castore/src/directoryservice/bigtable.rs +++ b/tvix/castore/src/directoryservice/bigtable.rs @@ -353,7 +353,7 @@ impl ServiceBuilder for BigtableParameters { async fn build<'a>( &'a self, _instance_name: &str, - _context: &CompositionContext, + _context: &CompositionContext, ) -> Result, Box> { Ok(Arc::new( BigtableDirectoryService::connect(self.clone()).await?, diff --git a/tvix/castore/src/directoryservice/combinators.rs b/tvix/castore/src/directoryservice/combinators.rs index 74d02f1ad2b9..0fdc82c16cb0 100644 --- a/tvix/castore/src/directoryservice/combinators.rs +++ b/tvix/castore/src/directoryservice/combinators.rs @@ -167,7 +167,7 @@ impl ServiceBuilder for CacheConfig { async fn build<'a>( &'a self, _instance_name: &str, - context: &CompositionContext, + context: &CompositionContext, ) -> Result, Box> { let (near, far) = futures::join!( context.resolve(self.near.clone()), diff --git a/tvix/castore/src/directoryservice/grpc.rs b/tvix/castore/src/directoryservice/grpc.rs index 415796fa52cc..ff08bad4bd0f 100644 --- a/tvix/castore/src/directoryservice/grpc.rs +++ b/tvix/castore/src/directoryservice/grpc.rs @@ -243,7 +243,7 @@ impl ServiceBuilder for GRPCDirectoryServiceConfig { async fn build<'a>( &'a self, _instance_name: &str, - _context: &CompositionContext, + _context: &CompositionContext, ) -> Result, Box> { let client = proto::directory_service_client::DirectoryServiceClient::new( crate::tonic::channel_from_url(&self.url.parse()?).await?, diff --git a/tvix/castore/src/directoryservice/memory.rs b/tvix/castore/src/directoryservice/memory.rs index c1fc361f0d59..ada4606a5a57 100644 --- a/tvix/castore/src/directoryservice/memory.rs +++ b/tvix/castore/src/directoryservice/memory.rs @@ -108,7 +108,7 @@ impl ServiceBuilder for MemoryDirectoryServiceConfig { async fn build<'a>( &'a self, _instance_name: &str, - _context: &CompositionContext, + _context: &CompositionContext, ) -> Result, Box> { Ok(Arc::new(MemoryDirectoryService::default())) } diff --git a/tvix/castore/src/directoryservice/object_store.rs b/tvix/castore/src/directoryservice/object_store.rs index 0f0423a49e5b..a9a2cc8ef5c0 100644 --- a/tvix/castore/src/directoryservice/object_store.rs +++ b/tvix/castore/src/directoryservice/object_store.rs @@ -211,7 +211,7 @@ impl ServiceBuilder for ObjectStoreDirectoryServiceConfig { async fn build<'a>( &'a self, _instance_name: &str, - _context: &CompositionContext, + _context: &CompositionContext, ) -> Result, Box> { let (object_store, path) = object_store::parse_url_opts( &self.object_store_url.parse()?, diff --git a/tvix/castore/src/directoryservice/sled.rs b/tvix/castore/src/directoryservice/sled.rs index 61058b392bb3..5766dec1a5c2 100644 --- a/tvix/castore/src/directoryservice/sled.rs +++ b/tvix/castore/src/directoryservice/sled.rs @@ -176,7 +176,7 @@ impl ServiceBuilder for SledDirectoryServiceConfig { async fn build<'a>( &'a self, _instance_name: &str, - _context: &CompositionContext, + _context: &CompositionContext, ) -> Result, Box> { match self { SledDirectoryServiceConfig { -- cgit 1.4.1