about summary refs log tree commit diff
path: root/third_party/nix/src/proto/worker.proto
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2020-08-20T01·32+0100
committertazjin <mail@tazj.in>2020-08-20T11·48+0000
commit19e874a9854c0d7f49d79fa98177a84b6997ce9a (patch)
treef6e68f233b45c6e596ee0719d09abf651e7d083f /third_party/nix/src/proto/worker.proto
parent883de9b8d71b9cb984d8ff315b4dcc30e0ca9082 (diff)
feat(tvix): Introduce build event streams in worker protocol r/1685
Introduces a new `BuildEvent` proto type which is streamed in response
to calls that trigger builds of derivations.

This type can currently supply build statuses, log lines and
information about builds starting.

This is in preparation for threading build logs through the processes.

Since we have nowhere to send the logs (yet), a null sink is used
instead.

Co-authored-by: Griffin Smith <grfn@gws.fyi>
Change-Id: If7332337b89506c7e404cd20174acdaa1a3be4e8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1793
Tested-by: BuildkiteCI
Reviewed-by: glittershark <grfn@gws.fyi>
Reviewed-by: kanepyork <rikingcoding@gmail.com>
Diffstat (limited to 'third_party/nix/src/proto/worker.proto')
-rw-r--r--third_party/nix/src/proto/worker.proto35
1 files changed, 28 insertions, 7 deletions
diff --git a/third_party/nix/src/proto/worker.proto b/third_party/nix/src/proto/worker.proto
index fe89b292a2e5..6a80b3e32b42 100644
--- a/third_party/nix/src/proto/worker.proto
+++ b/third_party/nix/src/proto/worker.proto
@@ -27,7 +27,7 @@ service WorkerService {
 
   // 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 (stream BuildEvent);
 
   // TODO: What does this do?
   rpc EnsurePath(StorePath) returns (google.protobuf.Empty);
@@ -90,7 +90,7 @@ service WorkerService {
 
   // Build a single non-materialized derivation (i.e. not from an
   // on-disk .drv file).
-  rpc BuildDerivation(BuildDerivationRequest) returns (BuildDerivationResponse);
+  rpc BuildDerivation(BuildDerivationRequest) returns (stream BuildEvent);
 
   // Add signatures to the specified store path. The signatures are not
   // verified.
@@ -174,6 +174,32 @@ message Signatures {
   repeated string sigs = 1;
 }
 
+// Represents the outcome of a build for a single store path.
+message BuildResult {
+  StorePath path = 1;
+  BuildStatus status = 2;
+  string msg = 3;
+}
+
+// Represents an event occuring during a build.
+message BuildEvent {
+  message LogLine {
+    string line = 1;
+    StorePath path = 2;
+  }
+
+  oneof result_type {
+    // Build for a store path has finished
+    BuildResult result = 1;
+
+    // A line of build log output was produced
+    LogLine build_log = 2;
+
+    // Build for a store path has started
+    StorePath building_path = 3;
+  }
+}
+
 message IsValidPathResponse {
   bool is_valid = 1;
 }
@@ -316,11 +342,6 @@ message BuildDerivationRequest {
   BuildMode build_mode = 3;
 }
 
-message BuildDerivationResponse {
-  BuildStatus status = 1;
-  string error_message = 2;
-}
-
 message AddSignaturesRequest {
   StorePath path = 1;
   Signatures sigs = 2;