From 83291ff51ec85b89bb8aae2c0a260e00ebde7164 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Mon, 15 Jan 2024 20:13:26 +0200 Subject: 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 Reviewed-by: raitobezarius Tested-by: BuildkiteCI --- tvix/glue/src/known_paths.rs | 54 +++----------------------------------------- 1 file changed, 3 insertions(+), 51 deletions(-) (limited to 'tvix/glue/src') diff --git a/tvix/glue/src/known_paths.rs b/tvix/glue/src/known_paths.rs index b847ccada397..b0a4c0ac7129 100644 --- a/tvix/glue/src/known_paths.rs +++ b/tvix/glue/src/known_paths.rs @@ -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 }, - - /// 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 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 { -- cgit 1.4.1