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:
Florian Klink 2024-08-16 02:24:12 +03:00 committed by clbot
parent 49b173786c
commit 8ea7d2b60e
27 changed files with 555 additions and 461 deletions

View file

@ -200,7 +200,7 @@ mod test {
BuildRequest,
};
use tvix_castore::fixtures::DUMMY_DIGEST;
use tvix_castore::{DirectoryNode, Node};
use tvix_castore::Node;
use crate::tvix_build::NIX_ENVIRONMENT_VARS;
@ -209,8 +209,10 @@ mod test {
lazy_static! {
static ref INPUT_NODE_FOO_NAME: Bytes = "mp57d33657rf34lzvlbpfa1gjfv5gmpg-bar".into();
static ref INPUT_NODE_FOO: Node =
Node::Directory(DirectoryNode::new(DUMMY_DIGEST.clone(), 42,));
static ref INPUT_NODE_FOO: Node = Node::Directory {
digest: DUMMY_DIGEST.clone(),
size: 42
};
}
#[test]