2022-10-28 16:26:13 +02:00
|
|
|
// SPDX-FileCopyrightText: edef <edef@unfathomable.blue>
|
|
|
|
// SPDX-License-Identifier: OSL-3.0 OR MIT OR Apache-2.0
|
|
|
|
|
|
|
|
syntax = "proto3";
|
|
|
|
|
2023-09-21 21:32:44 +02:00
|
|
|
package tvix.castore.v1;
|
2022-11-19 22:20:14 +01:00
|
|
|
|
2023-09-21 21:32:44 +02:00
|
|
|
option go_package = "code.tvl.fyi/tvix/castore/protos;castorev1";
|
2022-10-28 16:26:13 +02:00
|
|
|
|
2022-10-28 16:26:24 +02:00
|
|
|
// A Directory can contain Directory, File or Symlink nodes.
|
2022-10-28 16:26:21 +02:00
|
|
|
// Each of these nodes have a name attribute, which is the basename in that directory
|
|
|
|
// and node type specific attributes.
|
|
|
|
// The name attribute:
|
2022-11-26 22:16:31 +01:00
|
|
|
// - MUST not contain slashes or null bytes
|
|
|
|
// - MUST not be '.' or '..'
|
|
|
|
// - MUST be unique across all three lists
|
2022-10-28 16:26:21 +02:00
|
|
|
// Elements in each list need to be lexicographically ordered by the name
|
|
|
|
// attribute.
|
2022-10-28 16:26:13 +02:00
|
|
|
message Directory {
|
|
|
|
repeated DirectoryNode directories = 1;
|
|
|
|
repeated FileNode files = 2;
|
2022-10-28 16:26:24 +02:00
|
|
|
repeated SymlinkNode symlinks = 3;
|
2022-10-28 16:26:13 +02:00
|
|
|
}
|
|
|
|
|
2022-10-28 16:26:21 +02:00
|
|
|
// A DirectoryNode represents a directory in a Directory.
|
2022-10-28 16:26:13 +02:00
|
|
|
message DirectoryNode {
|
2022-10-28 16:26:21 +02:00
|
|
|
// The (base)name of the directory
|
2023-07-18 18:37:25 +02:00
|
|
|
bytes name = 1;
|
2022-10-28 16:26:21 +02:00
|
|
|
// The blake3 hash of a Directory message, serialized in protobuf canonical form.
|
2022-10-30 11:32:22 +01:00
|
|
|
bytes digest = 2;
|
|
|
|
// Number of child elements in the Directory referred to by `digest`.
|
|
|
|
// Calculated by summing up the numbers of `directories`, `files` and
|
|
|
|
// `symlinks`, and for each directory, its size field. Used for inode
|
|
|
|
// number calculation.
|
|
|
|
// This field is precisely as verifiable as any other Merkle tree edge.
|
|
|
|
// Resolve `digest`, and you can compute it incrementally. Resolve the
|
|
|
|
// entire tree, and you can fully compute it from scratch.
|
|
|
|
// A credulous implementation won't reject an excessive size, but this is
|
|
|
|
// harmless: you'll have some ordinals without nodes. Undersizing is
|
|
|
|
// obvious and easy to reject: you won't have an ordinal for some nodes.
|
2022-10-28 16:26:13 +02:00
|
|
|
uint32 size = 3;
|
|
|
|
}
|
|
|
|
|
2022-10-28 16:26:21 +02:00
|
|
|
// A FileNode represents a regular or executable file in a Directory.
|
2022-10-28 16:26:13 +02:00
|
|
|
message FileNode {
|
2022-10-28 16:26:21 +02:00
|
|
|
// The (base)name of the file
|
2023-07-18 18:37:25 +02:00
|
|
|
bytes name = 1;
|
2022-10-30 11:32:22 +01:00
|
|
|
// The blake3 digest of the file contents
|
|
|
|
bytes digest = 2;
|
2022-10-28 16:26:21 +02:00
|
|
|
// The file content size
|
2022-10-28 16:26:13 +02:00
|
|
|
uint32 size = 3;
|
2022-10-28 16:26:21 +02:00
|
|
|
// Whether the file is executable
|
2022-10-28 16:26:13 +02:00
|
|
|
bool executable = 4;
|
|
|
|
}
|
|
|
|
|
2022-10-28 16:26:24 +02:00
|
|
|
// A SymlinkNode represents a symbolic link in a Directory.
|
|
|
|
message SymlinkNode {
|
2022-10-28 16:26:21 +02:00
|
|
|
// The (base)name of the symlink
|
2023-07-18 18:37:25 +02:00
|
|
|
bytes name = 1;
|
2022-10-28 16:26:21 +02:00
|
|
|
// The target of the symlink.
|
2023-07-18 18:37:25 +02:00
|
|
|
bytes target = 2;
|
2022-10-28 16:26:13 +02:00
|
|
|
}
|
2023-09-21 21:32:44 +02:00
|
|
|
|
|
|
|
// A Node is either a DirectoryNode, FileNode or SymlinkNode.
|
|
|
|
message Node {
|
|
|
|
oneof node {
|
|
|
|
DirectoryNode directory = 1;
|
|
|
|
FileNode file = 2;
|
|
|
|
SymlinkNode symlink = 3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|