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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
|
syntax = "proto3";
import "google/protobuf/empty.proto";
package nix.proto;
// Service representing a worker used for building and interfacing
// with the Nix store.
service Worker {
// Validates whether the supplied path is a valid store path.
rpc IsValidPath (IsValidPathRequest) returns (IsValidPathResponse);
// Checks whether any substitutes exist for the given path.
rpc HasSubstitutes (HasSubstitutesRequest) returns (HasSubstitutesResponse);
// Query referrers for a given path.
rpc QueryReferrers (QueryReferrersRequest) returns (QueryReferrersResponse);
// Add a NAR (I think?) to the store. The first stream request
// should be a message indicating metadata, the rest should be file
// chunks.
rpc AddToStore (stream AddToStoreRequest) returns (AddToStoreResponse);
// Adds the supplied string to the store, as a text file.
rpc AddTextToStore (AddTextToStoreRequest) returns (AddTextToStoreResponse);
// Build the specified derivations in one of the specified build
// modes, defaulting to a normal build.
rpc BuildPaths (BuildPathsRequest) returns (google.protobuf.Empty);
// TODO: What does this do?
rpc EnsurePath (EnsurePathRequest) returns (google.protobuf.Empty);
// TODO: What does this do?
rpc AddTempRoot (AddTempRootRequest) returns (google.protobuf.Empty);
// TODO: What does this do?
rpc AddIndirectRoot (AddIndirectRootRequest) returns (google.protobuf.Empty);
// TODO: What does this do?
rpc SyncWithGC (google.protobuf.Empty) returns (google.protobuf.Empty);
// TODO: What does this do?
rpc FindRoots(google.protobuf.Empty) returns (FindRootsResponse);
// TODO: What does this do?
rpc SetOptions(SetOptionsRequest) returns (google.protobuf.Empty);
// Ask the store to perform a garbage collection, based on the
// specified parameters. See `GCAction` for the possible actions.
rpc CollectGarbage(CollectGarbageRequest) returns (CollectGarbageResponse);
}
enum HashType {
UNKNOWN = 0;
MD5 = 1; // TODO(tazjin): still needed?
SHA1 = 2;
SHA256 = 3;
SHA512 = 4;
}
enum BuildMode {
Normal = 0;
Repair = 1;
Check = 2;
}
enum GCAction {
// Return the set of paths reachable from (i.e. in the closure of)
// the roots.
ReturnLive = 0;
// Return the set of paths not reachable from the roots.
ReturnDead = 1;
// Actually delete the latter set.
DeleteDead = 2;
// Delete the paths listed in `pathsToDelete', insofar as they are
// not reachable.
DeleteSpecific = 3;
}
message IsValidPathRequest {
string path = 1;
}
message IsValidPathResponse {
bool is_valid = 1;
}
message HasSubstitutesRequest {
string path = 1;
}
message HasSubstitutesResponse {
bool has_substitutes = 1;
}
message QueryReferrersRequest {
string path = 1;
}
message QueryReferrersResponse {
repeated string paths = 1;
}
message AddToStoreRequest {
message Metadata {
bool fixed = 1;
bool recursive = 2; // TODO(tazjin): what is this? "obsolete" comment?
HashType hash_type = 3;
string base_name = 4;
}
message Chunk {
bytes content = 1;
bool final = 2;
}
oneof add_oneof {
Metadata meta = 1;
Chunk chunk = 2;
}
}
message AddToStoreResponse {
string path = 1;
}
message AddTextToStoreRequest {
string name = 1;
string content = 2;
repeated string references = 3;
}
message AddTextToStoreResponse {
string path = 1;
}
message BuildPathsRequest {
repeated string drvs = 1;
BuildMode mode = 2;
}
message EnsurePathRequest {
string path = 1;
}
message AddTempRootRequest {
string path = 1;
}
message AddIndirectRootRequest {
string path = 1;
}
message FindRootsResponse {
map<string, string> roots = 1;
}
message SetOptionsRequest {
bool keep_failed = 1;
bool keep_going = 2;
bool try_fallback = 3;
uint32 max_build_jobs = 4;
uint32 verbose_build = 5; // TODO(tazjin): Maybe this should be bool, unclear.
uint32 build_cores = 6; // TODO(tazjin): Difference from max_build_jobs?
bool use_substitutes = 7;
map<string, string> overrides = 8; // TODO(tazjin): better name?
}
message CollectGarbageRequest {
// GC action that should be performed.
GCAction action = 1;
// For `DeleteSpecific', the paths to delete.
repeated string paths_to_delete = 2;
// If `ignore_liveness' is set, then reachability from the roots is
// ignored (dangerous!). However, the paths must still be
// unreferenced *within* the store (i.e., there can be no other
// store paths that depend on them).
bool ignore_liveness = 3;
// Stop after at least `max_freed' bytes have been freed.
uint64 max_freed = 4;
}
message CollectGarbageResponse {
// Depending on the action, the GC roots, or the paths that would be
// or have been deleted.
repeated string deleted_paths = 1;
// For `ReturnDead', `DeleteDead' and `DeleteSpecific', the number
// of bytes that would be or was freed.
uint64 bytes_freed = 2;
}
|