From a49c32ef420e48bac8207b5dd6a74dc37130dbb1 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Fri, 10 May 2024 14:02:46 +0300 Subject: [PATCH] refactor(tvix/store/pathinfo/sled): drop {blob,directory}_service These are not used anymore. Change-Id: I9c348391c9600e9319f171faf3eda7175ebf7076 Reviewed-on: https://cl.tvl.fyi/c/depot/+/11621 Tested-by: BuildkiteCI Autosubmit: flokli Reviewed-by: Connor Brewster --- tvix/store/src/pathinfoservice/from_addr.rs | 4 +-- tvix/store/src/pathinfoservice/sled.rs | 37 +++++---------------- 2 files changed, 10 insertions(+), 31 deletions(-) diff --git a/tvix/store/src/pathinfoservice/from_addr.rs b/tvix/store/src/pathinfoservice/from_addr.rs index 492457ae5..455909e7f 100644 --- a/tvix/store/src/pathinfoservice/from_addr.rs +++ b/tvix/store/src/pathinfoservice/from_addr.rs @@ -65,10 +65,10 @@ pub async fn from_addr( // TODO: expose other parameters as URL parameters? Box::new(if url.path().is_empty() { - SledPathInfoService::new_temporary(blob_service, directory_service) + SledPathInfoService::new_temporary() .map_err(|e| Error::StorageError(e.to_string()))? } else { - SledPathInfoService::new(url.path(), blob_service, directory_service) + SledPathInfoService::new(url.path()) .map_err(|e| Error::StorageError(e.to_string()))? }) } diff --git a/tvix/store/src/pathinfoservice/sled.rs b/tvix/store/src/pathinfoservice/sled.rs index 3be22de09..876155b11 100644 --- a/tvix/store/src/pathinfoservice/sled.rs +++ b/tvix/store/src/pathinfoservice/sled.rs @@ -8,57 +8,36 @@ use std::path::Path; use tonic::async_trait; use tracing::instrument; use tracing::warn; -use tvix_castore::{blobservice::BlobService, directoryservice::DirectoryService, Error}; +use tvix_castore::Error; /// SledPathInfoService stores PathInfo in a [sled](https://github.com/spacejam/sled). /// /// The PathInfo messages are stored as encoded protos, and keyed by their output hash, /// as that's currently the only request type available. -pub struct SledPathInfoService { +pub struct SledPathInfoService { db: sled::Db, - - #[allow(dead_code)] - blob_service: BS, - #[allow(dead_code)] - directory_service: DS, } -impl SledPathInfoService { - pub fn new>( - p: P, - blob_service: BS, - directory_service: DS, - ) -> Result { +impl SledPathInfoService { + pub fn new>(p: P) -> Result { let config = sled::Config::default() .use_compression(false) // is a required parameter .path(p); let db = config.open()?; - Ok(Self { - db, - blob_service, - directory_service, - }) + Ok(Self { db }) } - pub fn new_temporary(blob_service: BS, directory_service: DS) -> Result { + pub fn new_temporary() -> Result { let config = sled::Config::default().temporary(true); let db = config.open()?; - Ok(Self { - db, - blob_service, - directory_service, - }) + Ok(Self { db }) } } #[async_trait] -impl PathInfoService for SledPathInfoService -where - BS: AsRef + Send + Sync, - DS: AsRef + Send + Sync, -{ +impl PathInfoService for SledPathInfoService { #[instrument(level = "trace", skip_all, fields(path_info.digest = BASE64.encode(&digest)))] async fn get(&self, digest: [u8; 20]) -> Result, Error> { let resp = tokio::task::spawn_blocking({