chore(tvix/store): move NAR rendering logic into Renderer struct
This moves the logic rendering NARs to a struct using the previously introduced, more granular BlobService, ChunkService and DirectoryService. Instead of passing them around to the helper functions, they're kept as members of a struct. Remove the async invocations in the nar_renderer tests, there's nothing async in here. Change-Id: Ic6d24aaad68a1fda46ce29f2cdb5f7b87f481d5c Reviewed-on: https://cl.tvl.fyi/c/depot/+/8095 Reviewed-by: raitobezarius <tvl@lahfa.xyz> Tested-by: BuildkiteCI
This commit is contained in:
parent
cdb9458310
commit
df3223fd68
5 changed files with 277 additions and 183 deletions
22
tvix/store/src/nar/mod.rs
Normal file
22
tvix/store/src/nar/mod.rs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
use data_encoding::BASE64;
|
||||
use thiserror::Error;
|
||||
|
||||
mod renderer;
|
||||
|
||||
pub use renderer::NARRenderer;
|
||||
|
||||
/// Errors that can encounter while rendering NARs.
|
||||
#[derive(Debug, Error)]
|
||||
pub enum RenderError {
|
||||
#[error("failure talking to a backing store client: {0}")]
|
||||
StoreError(crate::Error),
|
||||
|
||||
#[error("unable to find directory {}, referred from {}", BASE64.encode(.0), .1)]
|
||||
DirectoryNotFound(Vec<u8>, String),
|
||||
|
||||
#[error("unable to find blob {}, referred from {}", BASE64.encode(.0), .1)]
|
||||
BlobNotFound(Vec<u8>, String),
|
||||
|
||||
#[error("failure using the NAR writer: {0}")]
|
||||
NARWriterError(std::io::Error),
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue