From 17ca547ed34082803c718859177e81464f8a1f3c Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sun, 19 Jul 2020 15:04:44 -0400 Subject: feat(3p/nix/nix-daemon): add factory function for WorkerServiceImpl 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 --- third_party/nix/src/nix-daemon/nix-daemon-proto.cc | 7 +++++++ third_party/nix/src/nix-daemon/nix-daemon-proto.hh | 13 +++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 third_party/nix/src/nix-daemon/nix-daemon-proto.hh (limited to 'third_party/nix') 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 1717e6df5c90..ffd34cc60a61 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 #include #include #include #include +#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 NewWorkerService(nix::Store* store) { + return std::make_unique(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 000000000000..5ffab9ebbe62 --- /dev/null +++ b/third_party/nix/src/nix-daemon/nix-daemon-proto.hh @@ -0,0 +1,13 @@ +#pragma once + +#include + +#include "libproto/worker.grpc.pb.h" +#include "libstore/store-api.hh" + +namespace nix::daemon { + +std::unique_ptr NewWorkerService( + nix::Store*); + +} // namespace nix::daemon -- cgit 1.4.1