about summary refs log tree commit diff
path: root/tvix/proto
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2022-10-30T10·32+0100
committerflokli <flokli@flokli.de>2022-11-08T17·57+0000
commit41883b6c08f648b58fdf2f37f8307fa208993570 (patch)
tree7f209cad3b3d5c2226688c32dfb5d558c0756d5a /tvix/proto
parent5731fbbee3c9f3a35f77e42291fc3a5be146b5f8 (diff)
chore(tvix/proto/castore.proto) rename *Node.{ref->digest} r/5273
As per the discussion in
https://cl.tvl.fyi/c/depot/+/7128/2..5/tvix/proto/castore.proto#b39, ref
sounds more like an external, stateful ID. Call this `digest`, to make
clear it's precisely this.

Change-Id: I81dd3769e2ce017de470ae92f72a38fb72015f10
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7134
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Reviewed-by: Adam Joseph <adam@westernsemico.com>
Diffstat (limited to 'tvix/proto')
-rw-r--r--tvix/proto/castore.proto22
1 files changed, 13 insertions, 9 deletions
diff --git a/tvix/proto/castore.proto b/tvix/proto/castore.proto
index aa3c9b37bcbe..89cfb82e48fe 100644
--- a/tvix/proto/castore.proto
+++ b/tvix/proto/castore.proto
@@ -24,13 +24,17 @@ message DirectoryNode {
     // The (base)name of the directory
     string name = 1;
     // The blake3 hash of a Directory message, serialized in protobuf canonical form.
-    bytes ref = 2;
-    // Number of child elements in the Directory referred to by ref.
-    // Calculated by summing up the numbers of `directories`, `files` and `symlinks`,
-    // and for each directory, its size field. Used for inode number calculation
-    // TODO(flokli): These numbers can't really be verified until you know the whole graph.
-    //               Is this a problem? Should we instead only have this field
-    //               in our local representation?
+    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;
 }
 
@@ -38,8 +42,8 @@ message DirectoryNode {
 message FileNode {
     // The (base)name of the file
     string name = 1;
-    // The blake3 hash of the file contents
-    bytes ref = 2;
+    // The blake3 digest of the file contents
+    bytes digest = 2;
     // The file content size
     uint32 size = 3;
     // Whether the file is executable