Add logging to PVF and other related parts (#3596)

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Sergei Shulepov
2021-08-08 19:39:16 +02:00
committed by GitHub
parent 968132155a
commit 9d6ed7ecae
10 changed files with 211 additions and 58 deletions
+20 -1
View File
@@ -54,7 +54,7 @@ impl Artifact {
/// multiple engine implementations the artifact ID should include the engine type as well.
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct ArtifactId {
code_hash: ValidationCodeHash,
pub(crate) code_hash: ValidationCodeHash,
}
impl ArtifactId {
@@ -84,6 +84,25 @@ impl ArtifactId {
}
}
/// A bundle of the artifact ID and the path.
///
/// Rationale for having this is two-fold:
///
/// - While we can derive the artifact path from the artifact id, it makes sense to carry it around
/// sometimes to avoid extra work.
/// - At the same time, carrying only path limiting the ability for logging.
#[derive(Debug, Clone)]
pub struct ArtifactPathId {
pub(crate) id: ArtifactId,
pub(crate) path: PathBuf,
}
impl ArtifactPathId {
pub(crate) fn new(artifact_id: ArtifactId, cache_path: &Path) -> Self {
Self { path: artifact_id.path(cache_path), id: artifact_id }
}
}
pub enum ArtifactState {
/// The artifact is ready to be used by the executor.
///