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<dyn Any> in the
value, which is downcasted to InstantiatonState<T>.

Change-Id: I2af11f26c535029adfb1c62905e0e7c4aaed7b51
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11980
Reviewed-by: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
Autosubmit: yuka <yuka@yuka.dev>
This commit is contained in:
Yureka 2024-07-19 10:51:05 +02:00 committed by clbot
parent 7ccdf6dad5
commit 4801d6bf85
11 changed files with 64 additions and 46 deletions

View file

@ -119,7 +119,7 @@ impl ServiceBuilder for CombinedBlobServiceConfig {
async fn build<'a>(
&'a self,
_instance_name: &str,
context: &CompositionContext<dyn BlobService>,
context: &CompositionContext,
) -> Result<Arc<dyn BlobService>, Box<dyn std::error::Error + Send + Sync>> {
let (local, remote) = futures::join!(
context.resolve(self.local.clone()),