about summary refs log tree commit diff
path: root/third_party/nix/src
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2020-07-16T01·10+0100
committertazjin <mail@tazj.in>2020-07-16T01·19+0000
commit622250bff9062cd89f722a275aba3f59ad8c0b51 (patch)
tree303c75601be122542f39aa2667a2a1ef98a6400b /third_party/nix/src
parent1bd08e73cd053c526f60b49c6ba2f03b11271e1b (diff)
feat(3p/nix/proto): Add additional worker-protocol operations r/1311
On the chopping block this time:

* requests/responses that return one or more store paths, and contain
  nothing else, have been changed to use the same types (StorePath and
  StorePaths, respectively)
* QuerySubstitutablePathInfos has been added. It should be noted that
  legacy Nix has two versions of this call, one that only queries a
  single info (deprecated) and one that queries multiple. We have only
  implemented the latter.
* QueryDerivationOutputs has been added.

Change-Id: Iccc9041e7064e141cf593467ecdcc327581c4056
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1186
Tested-by: BuildkiteCI
Reviewed-by: glittershark <grfn@gws.fyi>
Diffstat (limited to 'third_party/nix/src')
-rw-r--r--third_party/nix/src/proto/worker.proto91
1 files changed, 43 insertions, 48 deletions
diff --git a/third_party/nix/src/proto/worker.proto b/third_party/nix/src/proto/worker.proto
index 66f8086eb6bf..3199f0d38246 100644
--- a/third_party/nix/src/proto/worker.proto
+++ b/third_party/nix/src/proto/worker.proto
@@ -8,37 +8,37 @@ package nix.proto;
 // with the Nix store.
 service Worker {
   // Validates whether the supplied path is a valid store path.
-  rpc IsValidPath (IsValidPathRequest) returns (IsValidPathResponse);
+  rpc IsValidPath(StorePath) returns (IsValidPathResponse);
 
   // Checks whether any substitutes exist for the given path.
-  rpc HasSubstitutes (HasSubstitutesRequest) returns (HasSubstitutesResponse);
+  rpc HasSubstitutes(StorePath) returns (HasSubstitutesResponse);
 
   // Query referrers for a given path.
-  rpc QueryReferrers (QueryReferrersRequest) returns (QueryReferrersResponse);
+  rpc QueryReferrers(StorePath) returns (StorePaths);
 
   // 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);
+  rpc AddToStore(stream AddToStoreRequest) returns (StorePath);
 
   // Adds the supplied string to the store, as a text file.
-  rpc AddTextToStore (AddTextToStoreRequest) returns (AddTextToStoreResponse);
+  rpc AddTextToStore(AddTextToStoreRequest) returns (StorePath);
 
   // Build the specified derivations in one of the specified build
   // modes, defaulting to a normal build.
-  rpc BuildPaths (BuildPathsRequest) returns (google.protobuf.Empty);
+  rpc BuildPaths(BuildPathsRequest) returns (google.protobuf.Empty);
 
   // TODO: What does this do?
-  rpc EnsurePath (EnsurePathRequest) returns (google.protobuf.Empty);
+  rpc EnsurePath(StorePath) returns (google.protobuf.Empty);
 
   // TODO: What does this do?
-  rpc AddTempRoot (AddTempRootRequest) returns (google.protobuf.Empty);
+  rpc AddTempRoot(StorePath) returns (google.protobuf.Empty);
 
   // TODO: What does this do?
-  rpc AddIndirectRoot (AddIndirectRootRequest) returns (google.protobuf.Empty);
+  rpc AddIndirectRoot(StorePath) returns (google.protobuf.Empty);
 
   // TODO: What does this do?
-  rpc SyncWithGC (google.protobuf.Empty) returns (google.protobuf.Empty);
+  rpc SyncWithGC(google.protobuf.Empty) returns (google.protobuf.Empty);
 
   // TODO: What does this do?
   rpc FindRoots(google.protobuf.Empty) returns (FindRootsResponse);
@@ -49,11 +49,17 @@ service Worker {
   // Ask the store to perform a garbage collection, based on the
   // specified parameters. See `GCAction` for the possible actions.
   rpc CollectGarbage(CollectGarbageRequest) returns (CollectGarbageResponse);
+
+  // TODO: What does this do?
+  rpc QuerySubstitutablePathInfos(StorePaths) returns (SubstitutablePathInfos);
+
+  // TODO: What does this do?
+  rpc QueryDerivationOutputs(StorePath) returns (StorePaths);
 }
 
 enum HashType {
   UNKNOWN = 0;
-  MD5 = 1; // TODO(tazjin): still needed?
+  MD5 = 1;  // TODO(tazjin): still needed?
   SHA1 = 2;
   SHA256 = 3;
   SHA512 = 4;
@@ -81,34 +87,30 @@ enum GCAction {
   DeleteSpecific = 3;
 }
 
-message IsValidPathRequest {
+// Generic type for any RPC call that just reads or returns a single
+// store path.
+message StorePath {
   string path = 1;
 }
 
-message IsValidPathResponse {
-  bool is_valid = 1;
+// Generic type for any RPC call that just reads or returns a list of
+// store paths.
+message StorePaths {
+  repeated string paths = 1;
 }
 
-message HasSubstitutesRequest {
-  string path = 1;
+message IsValidPathResponse {
+  bool is_valid = 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?
+    bool recursive = 2;  // TODO(tazjin): what is this? "obsolete" comment?
     HashType hash_type = 3;
     string base_name = 4;
   }
@@ -124,37 +126,17 @@ message AddToStoreRequest {
   }
 }
 
-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;
 }
@@ -164,10 +146,11 @@ message SetOptionsRequest {
   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?
+  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?
+  map<string, string> overrides = 8;  // TODO(tazjin): better name?
 }
 
 message CollectGarbageRequest {
@@ -196,3 +179,15 @@ message CollectGarbageResponse {
   // of bytes that would be or was freed.
   uint64 bytes_freed = 2;
 }
+
+message SubstitutablePathInfos {
+  message PathInfo {
+    string path = 1;
+    string deriver = 2;
+    uint64 download_size = 3;
+    uint64 nar_size = 4;
+    repeated string references = 5;
+  }
+
+  repeated PathInfo path_infos = 1;
+}