GRPC C++  0.13.1-pre1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 (Service *service)
 Register a service. More...
 
void RegisterAsyncGenericService (AsyncGenericService *service)
 Register a generic service. More...
 
void RegisterService (const grpc::string &host, Service *service)
 Register a service. More...
 
void SetMaxMessageSize (int max_message_size)
 Set max message size in bytes. More...
 
void SetCompressionOptions (const grpc_compression_options &options)
 Set the compression options to be used by the server. More...
 
void SetOption (std::unique_ptr< ServerBuilderOption > option)
 
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::RegisterService ( Service 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,
Service 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::SetCompressionOptions ( const grpc_compression_options &  options)
inline

Set the compression options to be used by the server.

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

Set max message size in bytes.

void grpc::ServerBuilder::SetOption ( std::unique_ptr< ServerBuilderOption option)

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