diff options
author | Florian Klink <flokli@flokli.de> | 2022-10-30T11·57+0100 |
---|---|---|
committer | flokli <flokli@flokli.de> | 2022-12-22T14·35+0000 |
commit | 2e04f68df8c69034151cce5b56ceedb0653687cd (patch) | |
tree | 6048fc51e54da538583ed44655e6298b6b4eb21e /tvix/store | |
parent | 870cd533dd98e708f9870a8c85577681697db372 (diff) |
feat(tvix/proto): add rpc_directory.proto r/5471
This provides an interface to retrieve and upload single Directory messages, or a DAG of them. Change-Id: Id9e7084bd697d843649a122da2c992a3e36d808c Reviewed-on: https://cl.tvl.fyi/c/depot/+/7137 Tested-by: BuildkiteCI Reviewed-by: Adam Joseph <adam@westernsemico.com>
Diffstat (limited to 'tvix/store')
-rw-r--r-- | tvix/store/build.rs | 1 | ||||
-rw-r--r-- | tvix/store/default.nix | 1 | ||||
-rw-r--r-- | tvix/store/protos/rpc_directory.proto | 46 |
3 files changed, 48 insertions, 0 deletions
diff --git a/tvix/store/build.rs b/tvix/store/build.rs index 35fbe5a6770c..4d3dc513f672 100644 --- a/tvix/store/build.rs +++ b/tvix/store/build.rs @@ -6,6 +6,7 @@ fn main() -> Result<()> { "tvix/store/protos/castore.proto", "tvix/store/protos/pathinfo.proto", "tvix/store/protos/rpc_blobstore.proto", + "tvix/store/protos/rpc_directory.proto", "tvix/store/protos/rpc_pathinfo.proto", ], // If we are in running `cargo build` manually, using `../..` works fine, diff --git a/tvix/store/default.nix b/tvix/store/default.nix index 735938c1f2f6..1dbf01923545 100644 --- a/tvix/store/default.nix +++ b/tvix/store/default.nix @@ -5,6 +5,7 @@ let ./protos/castore.proto ./protos/pathinfo.proto ./protos/rpc_blobstore.proto + ./protos/rpc_directory.proto ./protos/rpc_pathinfo.proto ]; diff --git a/tvix/store/protos/rpc_directory.proto b/tvix/store/protos/rpc_directory.proto new file mode 100644 index 000000000000..29e175a106b2 --- /dev/null +++ b/tvix/store/protos/rpc_directory.proto @@ -0,0 +1,46 @@ +// SPDX-License-Identifier: MIT +// Copyright © 2022 The Tvix Authors +syntax = "proto3"; + +package tvix.store.v1; + +import "tvix/store/protos/castore.proto"; + +service DirectoryService { + // Get retrieves a stream of Directory messages, by using the lookup + // parameters in GetDirectoryRequest. + // Keep in mind multiple DirectoryNodes in different parts of the graph might + // have the same digest if they have the same underlying contents, + // so sending subsequent ones can be omitted. + rpc Get(GetDirectoryRequest) returns (stream Directory); + + // Put uploads a graph of Directory messages. + // Individual Directory messages need to be send in an order walking up + // from the leaves to the root - a Directory message can only refer to + // Directory messages previously sent in the same stream. + // Keep in mind multiple DirectoryNodes in different parts of the graph might + // have the same digest if they have the same underlying contents, + // so sending subsequent ones can be omitted. + // We might add a separate method, allowing to send partial graphs at a later + // time, if requiring to send the full graph turns out to be a problem. + rpc Put(stream Directory) returns (PutDirectoryResponse); +} + +message GetDirectoryRequest { + oneof by_what { + // The blake3 hash of the (root) Directory message, serialized in + // protobuf canonical form. + // Keep in mind this can be a subtree of another root. + bytes digest = 1; + } + + // If set to true, recursively resolve all child Directory messages. + // Directory messages SHOULD be streamed in a recursive breadth-first walk, + // but other orders are also fine, as long as Directory messages are only + // sent after they are referred to from previously sent Directory messages. + bool recursive = 2; +} + +message PutDirectoryResponse { + bytes root_digest = 1; +} |