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 <isomer@tvl.fyi>
This commit is contained in:
parent
2ef1060361
commit
17ca547ed3
2 changed files with 20 additions and 0 deletions
|
@ -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
|
||||
|
|
13
third_party/nix/src/nix-daemon/nix-daemon-proto.hh
vendored
Normal file
13
third_party/nix/src/nix-daemon/nix-daemon-proto.hh
vendored
Normal file
|
@ -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
|
Loading…
Reference in a new issue