GRPC C++  0.11.0.0
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Data Structures | Public Member Functions
grpc::ServerBuilder Class Reference

A builder class for the creation and startup of grpc::Server instances. More...

#include <server_builder.h>

Public Member Functions

 ServerBuilder ()
 
void RegisterService (SynchronousService *service)
 Register a service. More...
 
void RegisterAsyncService (AsynchronousService *service)
 Register an asynchronous service. More...
 
void RegisterAsyncGenericService (AsyncGenericService *service)
 Register a generic service. More...
 
void RegisterService (const grpc::string &host, SynchronousService *service)
 Register a service. More...
 
void RegisterAsyncService (const grpc::string &host, AsynchronousService *service)
 Register an asynchronous service. More...
 
void SetMaxMessageSize (int max_message_size)
 Set max message size in bytes. More...
 
void AddListeningPort (const grpc::string &addr, std::shared_ptr< ServerCredentials > creds, int *selected_port=nullptr)
 Tries to bind server to the given addr. More...
 
std::unique_ptr
< ServerCompletionQueue
AddCompletionQueue ()
 Add a completion queue for handling asynchronous services Caller is required to keep this completion queue live until the server is destroyed. More...
 
std::unique_ptr< ServerBuildAndStart ()
 Return a running server which is ready for processing calls. More...
 

Detailed Description

A builder class for the creation and startup of grpc::Server instances.

Constructor & Destructor Documentation

grpc::ServerBuilder::ServerBuilder ( )

Member Function Documentation

std::unique_ptr<ServerCompletionQueue> grpc::ServerBuilder::AddCompletionQueue ( )

Add a completion queue for handling asynchronous services Caller is required to keep this completion queue live until the server is destroyed.

void grpc::ServerBuilder::AddListeningPort ( const grpc::string addr,
std::shared_ptr< ServerCredentials creds,
int *  selected_port = nullptr 
)

Tries to bind server to the given addr.

It can be invoked multiple times.

Parameters
addrThe address to try to bind to the server (eg, localhost:1234, 192.168.1.1:31416, [::1]:27182, etc.). creds The credentials associated with the server.
selected_port[out]Upon success, updated to contain the port number. nullptr otherwise.
std::unique_ptr<Server> grpc::ServerBuilder::BuildAndStart ( )

Return a running server which is ready for processing calls.

void grpc::ServerBuilder::RegisterAsyncGenericService ( AsyncGenericService service)

Register a generic service.

Matches requests with any :authority

void grpc::ServerBuilder::RegisterAsyncService ( AsynchronousService service)

Register an asynchronous service.

This call does not take ownership of the service or completion queue. The service and completion queuemust exist for the lifetime of the Server instance returned by BuildAndStart(). Matches requests with any :authority

void grpc::ServerBuilder::RegisterAsyncService ( const grpc::string host,
AsynchronousService service 
)

Register an asynchronous service.

This call does not take ownership of the service or completion queue. The service and completion queuemust exist for the lifetime of the Server instance returned by BuildAndStart(). Only matches requests with :authority equal to host

void grpc::ServerBuilder::RegisterService ( SynchronousService service)

Register a service.

This call does not take ownership of the service. The service must exist for the lifetime of the Server instance returned by BuildAndStart(). Matches requests with any :authority

void grpc::ServerBuilder::RegisterService ( const grpc::string host,
SynchronousService service 
)

Register a service.

This call does not take ownership of the service. The service must exist for the lifetime of the Server instance returned by BuildAndStart(). Only matches requests with :authority host

void grpc::ServerBuilder::SetMaxMessageSize ( int  max_message_size)
inline

Set max message size in bytes.


The documentation for this class was generated from the following file: