From ff5e041fdbc43a01d64916ce477404a586787f7f Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Fri, 11 Nov 2022 22:46:20 +0000 Subject: chore(tvix/store): move castore.proto This moves the castore.proto file into the //tvix/store/protos directory. Per- component protos might make more sense, than a "tvix-wide" proto directory. Change-Id: Ie728210174b041e9285a0e2ac605d715d0f0cbda Reviewed-on: https://cl.tvl.fyi/c/depot/+/7285 Reviewed-by: tazjin Tested-by: BuildkiteCI --- tvix/proto/LICENSE | 2 +- tvix/proto/castore.proto | 59 ----------------------------------------- tvix/proto/default.nix | 1 - tvix/store/protos/LICENSE | 21 +++++++++++++++ tvix/store/protos/castore.proto | 59 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 81 insertions(+), 61 deletions(-) delete mode 100644 tvix/proto/castore.proto create mode 100644 tvix/store/protos/LICENSE create mode 100644 tvix/store/protos/castore.proto (limited to 'tvix') diff --git a/tvix/proto/LICENSE b/tvix/proto/LICENSE index 36878fe4cbf1..2034ada6fd9a 100644 --- a/tvix/proto/LICENSE +++ b/tvix/proto/LICENSE @@ -1,4 +1,4 @@ -Copyright © 2021 The Tvix Authors +Copyright © The Tvix Authors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/tvix/proto/castore.proto b/tvix/proto/castore.proto deleted file mode 100644 index 89cfb82e48fe..000000000000 --- a/tvix/proto/castore.proto +++ /dev/null @@ -1,59 +0,0 @@ -// SPDX-FileCopyrightText: edef -// 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; -} diff --git a/tvix/proto/default.nix b/tvix/proto/default.nix index 26673cdf747f..35e2eba7fed4 100644 --- a/tvix/proto/default.nix +++ b/tvix/proto/default.nix @@ -5,6 +5,5 @@ pkgs.runCommand "tvix-cc-proto" { } '' mkdir $out - ${pkgs.protobuf}/bin/protoc -I ${./.} castore.proto --cpp_out=$out ${pkgs.protobuf}/bin/protoc -I ${./.} evaluator.proto --cpp_out=$out '' diff --git a/tvix/store/protos/LICENSE b/tvix/store/protos/LICENSE new file mode 100644 index 000000000000..2034ada6fd9a --- /dev/null +++ b/tvix/store/protos/LICENSE @@ -0,0 +1,21 @@ +Copyright © The Tvix Authors + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +“Software”), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/tvix/store/protos/castore.proto b/tvix/store/protos/castore.proto new file mode 100644 index 000000000000..e73160bf9dd1 --- /dev/null +++ b/tvix/store/protos/castore.proto @@ -0,0 +1,59 @@ +// SPDX-FileCopyrightText: edef +// SPDX-License-Identifier: OSL-3.0 OR MIT OR Apache-2.0 + +syntax = "proto3"; + +package tvix.store.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; +} -- cgit 1.4.1