diff options
author | Florian Klink <flokli@flokli.de> | 2022-10-29T11·28+0200 |
---|---|---|
committer | flokli <flokli@flokli.de> | 2022-12-22T14·35+0000 |
commit | 870cd533dd98e708f9870a8c85577681697db372 (patch) | |
tree | 658925222b9926a773efbbba824c48bba767a4b1 /tvix | |
parent | 22ed59fabd8714279b4538783ca2fb23b28b15a0 (diff) |
feat(tvix/proto): add rpc_pathinfo r/5470
This defines a service that can be used to upload and retrieve metadata of nix paths. Change-Id: Id86eb531ce4ae316adb15934b0d1386a14ba2132 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7136 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su> Reviewed-by: Adam Joseph <adam@westernsemico.com>
Diffstat (limited to 'tvix')
-rw-r--r-- | tvix/store/build.rs | 1 | ||||
-rw-r--r-- | tvix/store/default.nix | 1 | ||||
-rw-r--r-- | tvix/store/protos/rpc_pathinfo.proto | 42 |
3 files changed, 44 insertions, 0 deletions
diff --git a/tvix/store/build.rs b/tvix/store/build.rs index 4c2e7d59d61b..35fbe5a6770c 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_pathinfo.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 23916c6b57f6..735938c1f2f6 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_pathinfo.proto ]; protobufDep = prev: (prev.nativeBuildInputs or [ ]) ++ [ pkgs.protobuf ]; diff --git a/tvix/store/protos/rpc_pathinfo.proto b/tvix/store/protos/rpc_pathinfo.proto new file mode 100644 index 000000000000..160e594268c0 --- /dev/null +++ b/tvix/store/protos/rpc_pathinfo.proto @@ -0,0 +1,42 @@ +// SPDX-License-Identifier: MIT +// Copyright © 2022 The Tvix Authors +syntax = "proto3"; + +package tvix.store.v1; + +import "tvix/store/protos/pathinfo.proto"; + +service PathInfoService { + // Get retrieves a PathInfo object, by using the lookup parameters in + // GetPathInfoRequest. + // If the PathInfo object contains a DirectoryNode, it needs to be looked + // up separately via the DirectoryService, which is purely + // content-addressed. + rpc Get(GetPathInfoRequest) returns (PathInfo); + + // Put uploads a PathInfo object to the remote end. It MUST not return + // until the PathInfo object has been written on the the remote end. + // The remote end MAY check if a potential DirectoryNode has already been + // uploaded. + // Uploading clients SHOULD obviously not steer other machines to try to + // substitute before from the remote end before having finished uploading + // PathInfo, Directories and Blobs. + // The returned PathInfo object MAY contain additional narinfo signatures, + // but is otherwise left untouched. + rpc Put(PathInfo) returns (PathInfo); +} + +// GetPathInfoRequest describes the lookup parameters that can be used to +// lookup a PathInfo objects. +// Currently, only a lookup by output hash is supported. +message GetPathInfoRequest { + oneof by_what { + // The output hash of a nix path (20 bytes). + // This is the nixbase32-decoded portion of a Nix output path, so to substitute + // /nix/store/xm35nga2g20mz5sm5l6n8v3bdm86yj83-cowsay-3.04 + // this field would contain nixbase32dec("xm35nga2g20mz5sm5l6n8v3bdm86yj83"). + bytes by_output_hash = 1; + + // placeholder: by_drv and output name? + } +} |