about summary refs log tree commit diff
path: root/third_party/nix/src/libstore/store-api.cc
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/nix/src/libstore/store-api.cc')
-rw-r--r--third_party/nix/src/libstore/store-api.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/third_party/nix/src/libstore/store-api.cc b/third_party/nix/src/libstore/store-api.cc
index 2598c4ce2ebd..444ec73cc79f 100644
--- a/third_party/nix/src/libstore/store-api.cc
+++ b/third_party/nix/src/libstore/store-api.cc
@@ -10,6 +10,7 @@
 #include <glog/logging.h>
 #include <grpcpp/create_channel.h>
 
+#include "libproto/worker.pb.h"
 #include "libstore/crypto.hh"
 #include "libstore/derivations.hh"
 #include "libstore/globals.hh"
@@ -21,7 +22,7 @@
 
 namespace nix {
 
-std::optional<BuildMode> build_mode_from(nix::proto::BuildMode mode) {
+std::optional<BuildMode> BuildModeFrom(nix::proto::BuildMode mode) {
   switch (mode) {
     case nix::proto::BuildMode::Normal:
       return BuildMode::bmNormal;
@@ -34,6 +35,17 @@ std::optional<BuildMode> build_mode_from(nix::proto::BuildMode mode) {
   }
 }
 
+nix::proto::BuildMode BuildModeToProto(BuildMode mode) {
+  switch (mode) {
+    case BuildMode::bmNormal:
+      return nix::proto::BuildMode::Normal;
+    case BuildMode::bmRepair:
+      return nix::proto::BuildMode::Repair;
+    case BuildMode::bmCheck:
+      return nix::proto::BuildMode::Check;
+  }
+}
+
 nix::proto::BuildStatus BuildResult::status_to_proto() {
   switch (status) {
     case BuildResult::Status::Built: