about summary refs log tree commit diff
path: root/tvix/proto/castore.proto
blob: 89cfb82e48fea62b9ca2b5ece3b708c46d2e568c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// SPDX-FileCopyrightText: edef <edef@unfathomable.blue>
// SPDX-License-Identifier: OSL-3.0 OR MIT OR Apache-2.0

syntax = "proto3";

package tvix.proto.v1;

// A Directory can contain Directory, File or Symlink nodes.
// Each of these nodes have a name attribute, which is the basename in that directory
// and node type specific attributes.
// The name attribute:
//  - may not contain slashes or null bytes
//  - needs to be unique across all three lists
// 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;
}

// A DirectoryNode represents a directory in a Directory.
message DirectoryNode {
    // The (base)name of the directory
    string name = 1;
    // The blake3 hash of a Directory message, serialized in protobuf canonical form.
    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.
    uint32 size = 3;
}

// A FileNode represents a regular or executable file in a Directory.
message FileNode {
    // The (base)name of the file
    string name = 1;
    // The blake3 digest of the file contents
    bytes digest = 2;
    // The file content size
    uint32 size = 3;
    // Whether the file is executable
    bool executable = 4;
}

// A SymlinkNode represents a symbolic link in a Directory.
message SymlinkNode {
    // The (base)name of the symlink
    string name = 1;
    // The target of the symlink.
    string target = 2;
}