refactor(tvix/store/pathinfo/memory): drop {blob,directory}_service

These are not used anymore.

Change-Id: I6c16b4d80ddaabcb75fec3ea3e32b923b7719485
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11620
Tested-by: BuildkiteCI
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Autosubmit: flokli <flokli@flokli.de>
This commit is contained in:
Florian Klink 2024-05-10 14:01:56 +03:00 committed by clbot
parent 14766cfe1d
commit 03af6ab725
3 changed files with 6 additions and 26 deletions

View file

@ -47,7 +47,7 @@ pub async fn from_addr(
if url.has_host() || !url.path().is_empty() {
return Err(Error::StorageError("invalid url".to_string()));
}
Box::new(MemoryPathInfoService::new(blob_service, directory_service))
Box::<MemoryPathInfoService>::default()
}
"sled" => {
// sled doesn't support host, and a path can be provided (otherwise

View file

@ -7,33 +7,14 @@ use std::{
};
use tonic::async_trait;
use tvix_castore::Error;
use tvix_castore::{blobservice::BlobService, directoryservice::DirectoryService};
pub struct MemoryPathInfoService<BS, DS> {
#[derive(Default)]
pub struct MemoryPathInfoService {
db: Arc<RwLock<HashMap<[u8; 20], PathInfo>>>,
#[allow(dead_code)]
blob_service: BS,
#[allow(dead_code)]
directory_service: DS,
}
impl<BS, DS> MemoryPathInfoService<BS, DS> {
pub fn new(blob_service: BS, directory_service: DS) -> Self {
Self {
db: Default::default(),
blob_service,
directory_service,
}
}
}
#[async_trait]
impl<BS, DS> PathInfoService for MemoryPathInfoService<BS, DS>
where
BS: AsRef<dyn BlobService> + Send + Sync,
DS: AsRef<dyn DirectoryService> + Send + Sync,
{
impl PathInfoService for MemoryPathInfoService {
async fn get(&self, digest: [u8; 20]) -> Result<Option<PathInfo>, Error> {
let db = self.db.read().unwrap();

View file

@ -26,9 +26,8 @@ pub async fn make_grpc_path_info_service_client() -> super::BSDSPS {
let blob_service = blob_service.clone();
let directory_service = directory_service.clone();
async move {
let path_info_service: Arc<dyn PathInfoService> = Arc::from(
MemoryPathInfoService::new(blob_service.clone(), directory_service.clone()),
);
let path_info_service: Arc<dyn PathInfoService> =
Arc::from(MemoryPathInfoService::default());
let nar_calculation_service =
Box::new(SimpleRenderer::new(blob_service, directory_service))
as Box<dyn NarCalculationService>;