Open Lighting Architecture
|
The RPC channel used to communicate between the client and the server. This implementation runs over a ConnectedDescriptor which means it can be used over TCP or pipes.
Inherits RpcChannel.
Public Member Functions | |
StreamRpcChannel (Service *service, ola::io::ConnectedDescriptor *descriptor, ExportMap *export_map=NULL) | |
~StreamRpcChannel () | |
Destructor. | |
void | SetService (Service *service) |
Set the Service to use to handle incoming requests. | |
bool | PendingRPCs () const |
Check if there are any pending RPCs on the channel. Pending RPCs are those where a request has been sent, but no reply has been received. | |
void | DescriptorReady () |
Called when new data arrives on the descriptor. | |
void | SetChannelCloseHandler (SingleUseCallback0< void > *callback) |
Set the Callback to be run when the channel fails. The callback will be invoked if the descriptor is closed, or if writes to the descriptor fail. | |
void | CallMethod (const MethodDescriptor *method, RpcController *controller, const Message *request, Message *response, google::protobuf::Closure *done) |
Invoke an RPC method on this channel. | |
void | RequestComplete (OutstandingRequest *request) |
Invoked by the RPC completion handler when the server side response is ready. |
Static Public Attributes | |
static const unsigned int | PROTOCOL_VERSION = 1 |
the RPC protocol version. |
ola::rpc::StreamRpcChannel::StreamRpcChannel | ( | Service * | service, |
ola::io::ConnectedDescriptor * | descriptor, | ||
ExportMap * | export_map = NULL |
||
) |
@brief Create a new StreamRpcChannel.
service | the Service to use to handle incoming requests. Ownership is not transferred. |
descriptor | the descriptor to use for reading/writing data. The caller is responsible for registering the descriptor with the SelectServer. Ownership of the descriptor is not transferred. |
export_map | the ExportMap to use for stats |
|
inline |
Check if there are any pending RPCs on the channel. Pending RPCs are those where a request has been sent, but no reply has been received.
void ola::rpc::StreamRpcChannel::RequestComplete | ( | OutstandingRequest * | request | ) |
Invoked by the RPC completion handler when the server side response is ready.
request | the OutstandingRequest that is now complete. |
void ola::rpc::StreamRpcChannel::SetChannelCloseHandler | ( | SingleUseCallback0< void > * | callback | ) |
Set the Callback to be run when the channel fails. The callback will be invoked if the descriptor is closed, or if writes to the descriptor fail.
callback | the callback to run when the channel fails. |
|
inline |
Set the Service to use to handle incoming requests.
service | the new Service to use, ownership is not transferred. |