aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/grpcpp/server_builder.h
diff options
context:
space:
mode:
authorGravatar makdharma <>2018-02-23 14:51:46 -0800
committerGravatar makdharma <>2018-02-23 14:51:46 -0800
commit8065000697a6225d76ebbcc8b7eca9f01a9be474 (patch)
tree631957652131f23d1fe5c8397bad376d7394df02 /include/grpcpp/server_builder.h
parent5699cfcd4537df3a4358034fcfefed1ccc5a66a2 (diff)
Remove "final" keyword and make methods protected.
This adds extensibility to the API and makes custom implementation of the server possible.
Diffstat (limited to 'include/grpcpp/server_builder.h')
-rw-r--r--include/grpcpp/server_builder.h36
1 files changed, 19 insertions, 17 deletions
diff --git a/include/grpcpp/server_builder.h b/include/grpcpp/server_builder.h
index c35a6cf98a..8f148bcd06 100644
--- a/include/grpcpp/server_builder.h
+++ b/include/grpcpp/server_builder.h
@@ -52,7 +52,7 @@ class ServerBuilderPluginTest;
class ServerBuilder {
public:
ServerBuilder();
- ~ServerBuilder();
+ virtual ~ServerBuilder();
//////////////////////////////////////////////////////////////////////////////
// Primary API's
@@ -65,7 +65,7 @@ class ServerBuilder {
/// traffic (via AddListeningPort)
/// 3. [for async api only] completion queues have been added via
/// AddCompletionQueue
- std::unique_ptr<Server> BuildAndStart();
+ virtual std::unique_ptr<Server> BuildAndStart();
/// Register a service. This call does not take ownership of the service.
/// The service must exist for the lifetime of the \a Server instance returned
@@ -210,15 +210,29 @@ class ServerBuilder {
/// doc/workarounds.md.
ServerBuilder& EnableWorkaround(grpc_workaround_list id);
- private:
- friend class ::grpc::testing::ServerBuilderPluginTest;
-
+ protected:
struct Port {
grpc::string addr;
std::shared_ptr<ServerCredentials> creds;
int* selected_port;
};
+ typedef std::unique_ptr<grpc::string> HostString;
+ struct NamedService {
+ explicit NamedService(Service* s) : service(s) {}
+ NamedService(const grpc::string& h, Service* s)
+ : host(new grpc::string(h)), service(s) {}
+ HostString host;
+ Service* service;
+ };
+
+ std::vector<std::unique_ptr<ServerBuilderOption>> options_;
+ std::vector<std::unique_ptr<NamedService>> services_;
+ std::vector<Port> ports_;
+
+ private:
+ friend class ::grpc::testing::ServerBuilderPluginTest;
+
struct SyncServerSettings {
SyncServerSettings()
: num_cqs(1), min_pollers(1), max_pollers(2), cq_timeout_msec(10000) {}
@@ -238,20 +252,8 @@ class ServerBuilder {
int cq_timeout_msec;
};
- typedef std::unique_ptr<grpc::string> HostString;
- struct NamedService {
- explicit NamedService(Service* s) : service(s) {}
- NamedService(const grpc::string& h, Service* s)
- : host(new grpc::string(h)), service(s) {}
- HostString host;
- Service* service;
- };
-
int max_receive_message_size_;
int max_send_message_size_;
- std::vector<std::unique_ptr<ServerBuilderOption>> options_;
- std::vector<std::unique_ptr<NamedService>> services_;
- std::vector<Port> ports_;
SyncServerSettings sync_server_settings_;