From 5f9796cf9411028451ffc39ffe2c7ab52fd4d337 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Sat, 29 Oct 2022 13:27:00 +0200 Subject: feat(tvix/proto): add rpc_blobstore This defines a service that can be used to get and put content-addressed chunks of data. Change-Id: I36cf2278ed1daf71848c04fdfd14450b2268c5de Reviewed-on: https://cl.tvl.fyi/c/depot/+/7135 Tested-by: BuildkiteCI Reviewed-by: tazjin --- tvix/store/build.rs | 1 + tvix/store/default.nix | 1 + tvix/store/protos/rpc_blobstore.proto | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 tvix/store/protos/rpc_blobstore.proto (limited to 'tvix/store') diff --git a/tvix/store/build.rs b/tvix/store/build.rs index cc0bf22930a1..4c2e7d59d61b 100644 --- a/tvix/store/build.rs +++ b/tvix/store/build.rs @@ -5,6 +5,7 @@ fn main() -> Result<()> { &[ "tvix/store/protos/castore.proto", "tvix/store/protos/pathinfo.proto", + "tvix/store/protos/rpc_blobstore.proto", ], // If we are in running `cargo build` manually, using `../..` works fine, // but in case we run inside a nix build, we need to instead point PROTO_ROOT diff --git a/tvix/store/default.nix b/tvix/store/default.nix index 8fb80ee27bb6..23916c6b57f6 100644 --- a/tvix/store/default.nix +++ b/tvix/store/default.nix @@ -4,6 +4,7 @@ let protoRoot = depot.nix.sparseTree depot.path.origSrc [ ./protos/castore.proto ./protos/pathinfo.proto + ./protos/rpc_blobstore.proto ]; protobufDep = prev: (prev.nativeBuildInputs or [ ]) ++ [ pkgs.protobuf ]; diff --git a/tvix/store/protos/rpc_blobstore.proto b/tvix/store/protos/rpc_blobstore.proto new file mode 100644 index 000000000000..49a6b974f061 --- /dev/null +++ b/tvix/store/protos/rpc_blobstore.proto @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: MIT +// Copyright © 2022 The Tvix Authors +syntax = "proto3"; + +package tvix.store.v1; + +service BlobService { + rpc Get(GetBlobRequest) returns (GetBlobResponse); + rpc Put(PutBlobRequest) returns (PutBlobResponse); + + // TODO(flokli): We can get fancy here, and add methods to retrieve + // [Bao](https://github.com/oconnor663/bao/blob/master/docs/spec.md), and + // then support range requests, but that's left for later. +} + +message GetBlobRequest { + // The blake3 digest of the blob requested + bytes digest = 1; +} + +message GetBlobResponse { + bytes data = 1; +} + +message PutBlobRequest { + bytes data = 1; +} + +message PutBlobResponse { + // The blake3 digest of the data that was sent. + bytes digest = 1; +} -- cgit 1.4.1