refactor(tvix/castore): drop {Directory,File,Symlink}Node
Add a `SymlinkTarget` type to represent validated symlink targets. With this, no invalid states are representable, so we can make `Node` be just an enum of all three kind of types, and allow access to these fields directly. Change-Id: I20bdd480c8d5e64a827649f303c97023b7e390f2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12216 Reviewed-by: benjaminedwardwebb <benjaminedwardwebb@gmail.com> Autosubmit: flokli <flokli@flokli.de> Reviewed-by: Connor Brewster <cbrewster@hey.com> Tested-by: BuildkiteCI
This commit is contained in:
parent
49b173786c
commit
8ea7d2b60e
27 changed files with 555 additions and 461 deletions
|
|
@ -179,7 +179,7 @@ pub(crate) mod derivation_builtins {
|
|||
use nix_compat::nixhash::CAHash;
|
||||
use nix_compat::store_path::{build_ca_path, hash_placeholder};
|
||||
use sha2::Sha256;
|
||||
use tvix_castore::{FileNode, Node};
|
||||
use tvix_castore::Node;
|
||||
use tvix_eval::generators::Gen;
|
||||
use tvix_eval::{NixContext, NixContextElement, NixString};
|
||||
use tvix_store::proto::{NarInfo, PathInfo};
|
||||
|
|
@ -577,7 +577,11 @@ pub(crate) mod derivation_builtins {
|
|||
})
|
||||
.map_err(DerivationError::InvalidDerivation)?;
|
||||
|
||||
let root_node = Node::File(FileNode::new(blob_digest, blob_size, false));
|
||||
let root_node = Node::File {
|
||||
digest: blob_digest,
|
||||
size: blob_size,
|
||||
executable: false,
|
||||
};
|
||||
|
||||
// calculate the nar hash
|
||||
let (nar_size, nar_sha256) = state
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
use crate::builtins::errors::ImportError;
|
||||
use std::path::Path;
|
||||
use tvix_castore::import::ingest_entries;
|
||||
use tvix_castore::{FileNode, Node};
|
||||
use tvix_castore::Node;
|
||||
use tvix_eval::{
|
||||
builtin_macros::builtins,
|
||||
generators::{self, GenCo},
|
||||
|
|
@ -213,7 +213,11 @@ mod import_builtins {
|
|||
.tokio_handle
|
||||
.block_on(async { blob_writer.close().await })?;
|
||||
|
||||
let root_node = Node::File(FileNode::new(blob_digest, blob_size, false));
|
||||
let root_node = Node::File {
|
||||
digest: blob_digest,
|
||||
size: blob_size,
|
||||
executable: false,
|
||||
};
|
||||
|
||||
let ca_hash = if recursive_ingestion {
|
||||
let (_nar_size, nar_sha256) = state
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue