refactor(tvix/castore/tests): let gen_*_service return Boxes

Only convert to and reuse an Arc<…> where needed.

Change-Id: I2c1bc69cca5a4a3ebd3bdb33d6e28e1f5fb86cb9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10514
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
This commit is contained in:
Florian Klink 2023-12-31 23:33:41 +02:00 committed by flokli
parent 09a92b78d2
commit 597a6b6205
8 changed files with 63 additions and 37 deletions

View file

@ -1,8 +1,6 @@
//! A crate containing constructors to provide instances of a BlobService and
//! DirectoryService. Only used for testing purposes, but across crates.
//! Should be removed once we have a better concept of a "Service registry".
use std::sync::Arc;
use tonic::transport::{Channel, Endpoint, Server, Uri};
use crate::{
@ -16,12 +14,12 @@ use crate::{
},
};
pub fn gen_blob_service() -> Arc<dyn BlobService> {
Arc::new(MemoryBlobService::default())
pub fn gen_blob_service() -> Box<dyn BlobService> {
Box::<MemoryBlobService>::default()
}
pub fn gen_directory_service() -> Arc<dyn DirectoryService> {
Arc::new(MemoryDirectoryService::default())
pub fn gen_directory_service() -> Box<dyn DirectoryService> {
Box::<MemoryDirectoryService>::default()
}
/// This will spawn the a gRPC server with a DirectoryService client, connect a