-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlakitu.h
36 lines (30 loc) · 972 Bytes
/
lakitu.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef CPP_LAKITU_LAKITU_H
#define CPP_LAKITU_LAKITU_H
#include <grpcpp/grpcpp.h>
#include <string>
namespace lakitu {
uint16_t ReadPort(uint16_t default_port);
class Server {
public:
void AddListeningPort(const std::string& address, std::shared_ptr<grpc::ServerCredentials> creds);
void EnableHealthChecks();
void DisableHealthChecks();
void EnableReflection();
void DisableReflection();
void AddInterceptorFactory(
std::unique_ptr<grpc::experimental::ServerInterceptorFactoryInterface> interceptor_factory);
void AddService(grpc::Service* service);
void StartServer();
void Wait() const;
void StartAndWait();
private:
bool health_checks_enabled_ = true;
bool reflection_ = true;
std::string server_address_;
grpc::ServerBuilder builder;
std::unique_ptr<grpc::Server> delegate_;
std::vector<std::unique_ptr<grpc::experimental::ServerInterceptorFactoryInterface>>
interceptor_creators;
};
} // namespace lakitu
#endif