refactor(tvix/castore/import): restructure error types

Have ingest_entries return an Error type with only three kinds:

 - Error while uploading a specific Directory
 - Error while finalizing the directory upload
 - Error from the producer

Move all ingestion method-specific errors to the individual
implementations.

Change-Id: I2a015cb7ebc96d084cbe2b809f40d1b53a15daf3
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11557
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: Connor Brewster <cbrewster@hey.com>
This commit is contained in:
Florian Klink 2024-04-30 18:48:12 +03:00 committed by clbot
parent 77546d734e
commit c9d3946cb5
7 changed files with 126 additions and 72 deletions

View file

@ -6,6 +6,7 @@ use nix_compat::{
use reqwest::Url;
use std::rc::Rc;
use thiserror::Error;
use tvix_castore::import;
/// Errors related to derivation construction
#[derive(Debug, Error)]
@ -52,10 +53,7 @@ pub enum FetcherError {
Io(#[from] std::io::Error),
#[error(transparent)]
Import(#[from] tvix_castore::import::Error),
#[error(transparent)]
ImportArchive(#[from] tvix_castore::import::archive::Error),
Import(#[from] tvix_castore::import::IngestionError<import::archive::Error>),
#[error("Error calculating store path for fetcher output: {0}")]
StorePath(#[from] BuildStorePathError),