refactor(tvix/store/directorysvc): use [u8; 32] instead of Vec<u8>

Also, simplify the trait interface, only allowing lookups of Directory
objects by their digest.

Change-Id: I6eec28a8cb0557bed9b69df8b8ff99a5e0f8fe35
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8313
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
Florian Klink 2023-03-16 00:01:30 +01:00 committed by flokli
parent 9c08cbc973
commit ee23220564
12 changed files with 126 additions and 128 deletions

View file

@ -11,11 +11,8 @@ pub use self::sled::SledDirectoryService;
pub trait DirectoryService {
/// Get looks up a single Directory message by its digest.
/// In case the directory is not found, Ok(None) is returned.
fn get(
&self,
by_what: &proto::get_directory_request::ByWhat,
) -> Result<Option<proto::Directory>, Error>;
fn get(&self, digest: &[u8; 32]) -> Result<Option<proto::Directory>, Error>;
/// Get uploads a single Directory message, and returns the calculated
/// digest, or an error.
fn put(&self, directory: proto::Directory) -> Result<Vec<u8>, Error>;
fn put(&self, directory: proto::Directory) -> Result<[u8; 32], Error>;
}