Defines gRPC Server functionality.
More...
#include "rpc/server.hpp"
|
| void | start () |
| | Starts the grpc server. Can only be called once.
|
| |
| void | register_service (::grpc::Service *service) |
| | Registers a gRPC service.
|
| |
| std::shared_ptr< ResourceServer > | lookup_resource_server (const API &api) |
| | Returns reference to managed resource server.
|
| |
| void | add_resource (std::shared_ptr< Resource > resource) |
| | Adds a specific managed resource to the associated resource server.
|
| |
| void | add_resource (std::shared_ptr< Resource > resource, boost::optional< std::chrono::system_clock::time_point > deadline) |
| | Adds a specific managed resource to the associated resource server.
|
| |
| void | add_listening_port (const std::string &address, std::shared_ptr< GrpcServerCredentials > creds=nullptr) |
| | Adds a listening port to the server.
|
| |
|
void | wait () |
| | waits on server close, only returning when the server is closed.
|
| |
|
void | shutdown () |
| | Shutdown the gRPC server.
|
| |
|
|
class | ::viam::sdktests::TestServer |
| |
Defines gRPC Server functionality.
◆ add_listening_port()
| void viam::sdk::Server::add_listening_port |
( |
const std::string & | address, |
|
|
std::shared_ptr< GrpcServerCredentials > | creds = nullptr ) |
Adds a listening port to the server.
- Parameters
-
| address | The address to listen at. |
| creds | The server credentials; defaults to a insecure server credentials. |
- Exceptions
-
| `Exception` | if called after the server has been started. |
◆ add_resource() [1/2]
| void viam::sdk::Server::add_resource |
( |
std::shared_ptr< Resource > | resource | ) |
|
Adds a specific managed resource to the associated resource server.
- Parameters
-
| resource | The resource to add |
- Exceptions
-
◆ add_resource() [2/2]
| void viam::sdk::Server::add_resource |
( |
std::shared_ptr< Resource > | resource, |
|
|
boost::optional< std::chrono::system_clock::time_point > | deadline ) |
Adds a specific managed resource to the associated resource server.
- Parameters
-
| resource | The resource to add |
| deadline | Deadline after which to not add the resource |
- Exceptions
-
| `Exception` | if a matching ResourceServer doesn't exist in the server. |
| `Exception` | if the deadline is not nil and has passed |
◆ lookup_resource_server()
| std::shared_ptr< ResourceServer > viam::sdk::Server::lookup_resource_server |
( |
const API & | api | ) |
|
Returns reference to managed resource server.
- Parameters
-
| api | The api of the managed resource server. |
- Returns
- The requested resource server, or nullptr if it doesn't exist.
◆ register_service()
| void viam::sdk::Server::register_service |
( |
::grpc::Service * | service | ) |
|
Registers a gRPC service.
- Parameters
-
| service | The gRPC service to be registered. |
- Exceptions
-
| `Exception` | if called after the server has been started. |
◆ start()
| void viam::sdk::Server::start |
( |
| ) |
|
Starts the grpc server. Can only be called once.
- Exceptions
-
| `Exception` | if the server was already started. repeated calls. |
The documentation for this class was generated from the following file: