refactor(snix/castore): rename proto node to entry

In the castore Rust types, nodes don't have names, they only get names
my the mapping happening in a Directory struct.

However, in proto land, they do, as Directories are not maps, but three
(individually sorted) lists.

This has caused some confusion in the past. Let's fix this, by renaming
what used to be proto nodes to "Entry".

We also use this "entry" in a very similar fashion in the NAR reader,
describing something with a name, so this should be more consistent
and understandable. There's no change in the wire representation.

Change-Id: Ie6184d9a6e00c8114fc2a46bfd2bc90208a1d623
Reviewed-on: https://cl.snix.dev/c/snix/+/30296
Tested-by: besadii
Reviewed-by: Vova Kryachko <v.kryachko@gmail.com>
Autosubmit: Florian Klink <flokli@flokli.de>
This commit is contained in:
Florian Klink 2025-04-04 22:40:24 +01:00 committed by clbot
parent 7b20d0dac1
commit 06ffeec464
21 changed files with 365 additions and 355 deletions

View file

@ -8,7 +8,7 @@ package snix.castore.v1;
option go_package = "snix.dev/castore/proto;castorev1";
// A Directory can contain Directory, File or Symlink nodes.
// A Directory can contain Directory, File or Symlink entries.
// Each of these nodes have a name attribute, which is the basename in that
// directory and node type specific attributes.
// The name attribute:
@ -18,16 +18,16 @@ option go_package = "snix.dev/castore/proto;castorev1";
// Elements in each list need to be lexicographically ordered by the name
// attribute.
message Directory {
repeated DirectoryNode directories = 1;
repeated FileNode files = 2;
repeated SymlinkNode symlinks = 3;
repeated DirectoryEntry directories = 1;
repeated FileEntry files = 2;
repeated SymlinkEntry symlinks = 3;
}
// A DirectoryNode represents a directory in a Directory.
message DirectoryNode {
// A DirectoryEntry represents a directory.
message DirectoryEntry {
// The (base)name of the directory
bytes name = 1;
// The blake3 hash of a Directory message, serialized in protobuf canonical form.
// The blake3 digest of a Directory message.
bytes digest = 2;
// Number of child elements in the Directory referred to by `digest`.
// Calculated by summing up the numbers of `directories`, `files` and
@ -42,8 +42,8 @@ message DirectoryNode {
uint64 size = 3;
}
// A FileNode represents a regular or executable file in a Directory.
message FileNode {
// A FileEntry represents a regular or executable file.
message FileEntry {
// The (base)name of the file
bytes name = 1;
// The blake3 digest of the file contents
@ -54,19 +54,19 @@ message FileNode {
bool executable = 4;
}
// A SymlinkNode represents a symbolic link in a Directory.
message SymlinkNode {
// A SymlinkEntry represents a symbolic link.
message SymlinkEntry {
// The (base)name of the symlink
bytes name = 1;
// The target of the symlink.
bytes target = 2;
}
// A Node is either a DirectoryNode, FileNode or SymlinkNode.
message Node {
oneof node {
DirectoryNode directory = 1;
FileNode file = 2;
SymlinkNode symlink = 3;
// A Entry is either a DirectoryEntry, FileEntry or SymlinkEntry.
message Entry {
oneof entry {
DirectoryEntry directory = 1;
FileEntry file = 2;
SymlinkEntry symlink = 3;
}
}