refactor(tvix/glue/known_paths): drop some unused stuff

This are leftovers from the "reference scanning" approach (which we
didn't end up using).
We still want a concept of known paths, so we can trace IO into
storepaths back to the build recipe that'll produce it, so let's keep
the rest of this struct around.

Change-Id: I73d38e21e5b97950b8fc2a42176cae5f80d371c8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10632
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
This commit is contained in:
Florian Klink 2024-01-15 20:13:26 +02:00 committed by clbot
parent c5e2832cbd
commit 83291ff51e

View file

@ -5,59 +5,11 @@
//! knows about during the scope of a single evaluation and its
//! related builds.
//!
//! This data is required to scan derivation inputs for the build
//! references (the "build closure") that they make use of.
//!
//! Please see //tvix/eval/docs/build-references.md for more
//! information.
//! This data is required to find the derivation needed to actually trigger the
//! build, if necessary.
use crate::refscan::STORE_PATH_LEN;
use nix_compat::nixhash::NixHash;
use std::collections::{BTreeSet, HashMap};
#[derive(Debug, PartialEq)]
pub enum PathKind {
/// A literal derivation (`.drv`-file), and the *names* of its outputs.
Derivation { output_names: BTreeSet<String> },
/// An output of a derivation, its name, and the path of its derivation.
Output { name: String, derivation: String },
/// A plain store path (e.g. source files copied to the store).
Plain,
}
#[derive(Debug, PartialEq)]
pub struct KnownPath {
pub path: String,
pub kind: PathKind,
}
/// Internal struct to prevent accidental leaks of the truncated path
/// names.
#[repr(transparent)]
#[derive(Clone, Debug, Default, PartialEq, PartialOrd, Ord, Eq, Hash)]
pub struct PathName(String);
impl From<&str> for PathName {
fn from(s: &str) -> Self {
PathName(s[..STORE_PATH_LEN].to_string())
}
}
impl From<String> for PathName {
fn from(s: String) -> Self {
s.as_str().into()
}
}
/// This instance is required to pass PathName instances as needles to
/// the reference scanner.
impl AsRef<[u8]> for PathName {
fn as_ref(&self) -> &[u8] {
self.0.as_ref()
}
}
use std::collections::HashMap;
#[derive(Debug, Default)]
pub struct KnownPaths {