refactor(tvix/store): impl Default for MemoryDirectoryService
Change-Id: Ie75a1e67c8c0499ff10f60d90251b768937dad3a Reviewed-on: https://cl.tvl.fyi/c/depot/+/8235 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Autosubmit: flokli <flokli@flokli.de>
This commit is contained in:
parent
8e97c0deb0
commit
e716bd0957
2 changed files with 2 additions and 10 deletions
|
@ -6,19 +6,11 @@ use tracing::{instrument, warn};
|
|||
|
||||
use super::DirectoryService;
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Default)]
|
||||
pub struct MemoryDirectoryService {
|
||||
db: Arc<RwLock<HashMap<Vec<u8>, proto::Directory>>>,
|
||||
}
|
||||
|
||||
impl MemoryDirectoryService {
|
||||
pub fn new() -> Self {
|
||||
let db = Arc::new(RwLock::new(HashMap::default()));
|
||||
|
||||
Self { db }
|
||||
}
|
||||
}
|
||||
|
||||
impl DirectoryService for MemoryDirectoryService {
|
||||
// TODO: change api to only be by digest
|
||||
#[instrument(skip(self, by_what))]
|
||||
|
|
|
@ -14,7 +14,7 @@ pub fn gen_chunk_service() -> impl ChunkService + Clone {
|
|||
}
|
||||
|
||||
pub fn gen_directory_service() -> impl DirectoryService + Send + Sync + Clone + 'static {
|
||||
MemoryDirectoryService::new()
|
||||
MemoryDirectoryService::default()
|
||||
}
|
||||
|
||||
pub fn gen_pathinfo_service() -> impl PathInfoService {
|
||||
|
|
Loading…
Reference in a new issue