about summary refs log tree commit diff
path: root/third_party
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2020-07-19T19·04-0400
committerglittershark <grfn@gws.fyi>2020-07-20T14·45+0000
commit17ca547ed34082803c718859177e81464f8a1f3c (patch)
tree4f1ac697b77ee4bc400067157728567c2c44a9b5 /third_party
parent2ef1060361b582990f6b7335e16ce37bee6756f2 (diff)
feat(3p/nix/nix-daemon): add factory function for WorkerServiceImpl r/1409
Add a forward-declared factory function for constructing and returning a
WorkerServiceImpl, for eventual use in the main function for the nix
daemon

Change-Id: I9032d69b6ee3bc3b1f39f3d5d55f951cffad8145
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1293
Tested-by: BuildkiteCI
Reviewed-by: isomer <isomer@tvl.fyi>
Diffstat (limited to 'third_party')
-rw-r--r--third_party/nix/src/nix-daemon/nix-daemon-proto.cc7
-rw-r--r--third_party/nix/src/nix-daemon/nix-daemon-proto.hh13
2 files changed, 20 insertions, 0 deletions
diff --git a/third_party/nix/src/nix-daemon/nix-daemon-proto.cc b/third_party/nix/src/nix-daemon/nix-daemon-proto.cc
index 1717e6df5c..ffd34cc60a 100644
--- a/third_party/nix/src/nix-daemon/nix-daemon-proto.cc
+++ b/third_party/nix/src/nix-daemon/nix-daemon-proto.cc
@@ -1,9 +1,12 @@
+#include "nix-daemon-proto.hh"
+
 #include <google/protobuf/empty.pb.h>
 #include <google/protobuf/util/time_util.h>
 #include <grpcpp/impl/codegen/server_context.h>
 #include <grpcpp/impl/codegen/status.h>
 #include <grpcpp/impl/codegen/status_code_enum.h>
 
+#include "libmain/shared.hh"
 #include "libproto/worker.grpc.pb.h"
 #include "libproto/worker.pb.h"
 #include "libstore/derivations.hh"
@@ -283,4 +286,8 @@ class WorkerServiceImpl final : public WorkerService::Service {
   nix::Store* store_;
 };
 
+std::unique_ptr<WorkerService::Service> NewWorkerService(nix::Store* store) {
+  return std::make_unique<WorkerServiceImpl>(store);
+}
+
 }  // namespace nix::daemon
diff --git a/third_party/nix/src/nix-daemon/nix-daemon-proto.hh b/third_party/nix/src/nix-daemon/nix-daemon-proto.hh
new file mode 100644
index 0000000000..5ffab9ebbe
--- /dev/null
+++ b/third_party/nix/src/nix-daemon/nix-daemon-proto.hh
@@ -0,0 +1,13 @@
+#pragma once
+
+#include <memory>
+
+#include "libproto/worker.grpc.pb.h"
+#include "libstore/store-api.hh"
+
+namespace nix::daemon {
+
+std::unique_ptr<nix::proto::WorkerService::Service> NewWorkerService(
+    nix::Store*);
+
+}  // namespace nix::daemon