blob: f37794c291be27c3b5457c9aded10c1ba1d9ec1e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
// SPDX-License-Identifier: MIT
// Copyright © 2022 The Tvix Authors
syntax = "proto3";
package tvix.store.v1;
import "tvix/store/protos/pathinfo.proto";
option go_package = "code.tvl.fyi/tvix/store/protos;storev1";
service PathInfoService {
// Return a PathInfo message, identified by the decoded nixbase32 part
// of a Nix output path.
//
// To substitute /nix/store/xm35nga2g20mz5sm5l6n8v3bdm86yj83-
// cowsay-3.04 the bytes in the request would be
// nixbase32dec("xm35nga2g20mz5sm5l6n8v3bdm86yj83").
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);
// Calculate the NAR representation of the contents specified by the
// root_node. The calculation SHOULD be cached server-side for subsequent
// requests.
//
// All references (to blobs or Directory messages) MUST already exist in
// the store.
//
// The method can be used to produce a Nix fixed-output path, which
// contains the (compressed) sha256 of the NAR content representation in
// the root_node name (suffixed with the name).
//
// It can also be used to calculate arbitrary NAR hashes of output paths,
// in case a legacy Nix Binary Cache frontend is provided.
rpc CalculateNAR(Node) returns (CalculateNARResponse);
}
// 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;
};
}
// CalculateNARResponse is the response returned by the CalculateNAR request.
//
// It contains the size of the NAR representation (in bytes), and the sha56
// digest.
message CalculateNARResponse {
// This size of the NAR file, in bytes.
uint32 nar_size = 1;
// The sha256 of the NAR file representation.
bytes nar_sha256 = 2;
}
|