6f85dbfc06
Putting this in the PathInfoService trait makes much more sense, we can have direct control over where/how to cache the results in the implementation. This now requires each PathInfoService to hold pointers to BlobService and DirectoryService. Change-Id: I4faae780d43eae4beeb57bd5e190e6d1a5d3314e Reviewed-on: https://cl.tvl.fyi/c/depot/+/8724 Tested-by: BuildkiteCI Autosubmit: flokli <flokli@flokli.de> Reviewed-by: tazjin <tazjin@tvl.su>
20 lines
646 B
Rust
20 lines
646 B
Rust
use crate::{
|
|
blobservice::{BlobService, MemoryBlobService},
|
|
directoryservice::{DirectoryService, MemoryDirectoryService},
|
|
pathinfoservice::{MemoryPathInfoService, PathInfoService},
|
|
};
|
|
|
|
pub fn gen_blob_service() -> Box<dyn BlobService> {
|
|
Box::new(MemoryBlobService::default())
|
|
}
|
|
|
|
pub fn gen_directory_service() -> impl DirectoryService + Send + Sync + Clone + 'static {
|
|
MemoryDirectoryService::default()
|
|
}
|
|
|
|
pub fn gen_pathinfo_service<DS: DirectoryService + Clone>(
|
|
blob_service: Box<dyn BlobService>,
|
|
directory_service: DS,
|
|
) -> impl PathInfoService {
|
|
MemoryPathInfoService::new(blob_service, directory_service)
|
|
}
|