Open Lighting Architecture: ola::RpcChannel Class Reference

| Open Lighting Architecture 0.10.9

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Attributes | List of all members
ola::RpcChannel Class Reference

## Detailed Description

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.

## Public Types
typedef SingleUseCallback1< void, class RpcSession * > | CloseCallback
| The callback to run when the channel is closed.

## Public Member Functions
| RpcChannel (RpcService *service, ola::io::ConnectedDescriptor *descriptor, ExportMap *export_map=NULL)
| Create a new RpcChannel.
| ~RpcChannel ()
| Destructor.
void | SetService (RpcService *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 (CloseCallback *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 google::protobuf::MethodDescriptor *method, class RpcController *controller, const google::protobuf::Message *request, google::protobuf::Message *response, SingleUseCallback0< void > *done)
| Invoke an RPC method on this channel.
void | RequestComplete (class OutstandingRequest *request)
| Invoked by the RPC completion handler when the server side response is ready.
RpcSession * | Session ()
| Return the RpcSession associated with this channel.

## Static Public Attributes
static const unsigned int | PROTOCOL_VERSION = 1
| the RPC protocol version.

## Member Typedef Documentation

## ◆ CloseCallback

typedef SingleUseCallback1<void, class RpcSession*> ola::rpc::RpcChannel::CloseCallback

The callback to run when the channel is closed.

When run, the callback is passed the RpcSession associated with this channel.

## Constructor & Destructor Documentation

## ◆ RpcChannel()

ola::rpc::RpcChannel::RpcChannel | ( | RpcService * | service,
|  | ola::io::ConnectedDescriptor * | descriptor,
|  | ExportMap * | export_map = NULL )

Create a new RpcChannel.

Parameters

  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

## Member Function Documentation

## ◆ PendingRPCs()

bool ola::rpc::RpcChannel::PendingRPCs | ( |  | ) | const
| 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.

Returns
  true if there is one or more pending RPCs.

## ◆ RequestComplete()

void ola::rpc::RpcChannel::RequestComplete | ( | class OutstandingRequest * | request | ) |

Invoked by the RPC completion handler when the server side response is ready.

Parameters

  request | the OutstandingRequest that is now complete.

## ◆ Session()

RpcSession * ola::rpc::RpcChannel::Session | ( |  | ) |

Return the RpcSession associated with this channel.

Returns
  the RpcSession associated with this channel.

## ◆ SetChannelCloseHandler()

void ola::rpc::RpcChannel::SetChannelCloseHandler | ( | CloseCallback * | 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.

Parameters

  callback | the callback to run when the channel fails.

Note
  The callback will be run from the call stack of the RpcChannel object. This means you can't delete the RpcChannel object from within the called, you'll need to queue it up and delete it later.

## ◆ SetService()

void ola::rpc::RpcChannel::SetService | ( | RpcService * | service | ) |
| inline

Set the Service to use to handle incoming requests.

Parameters

  service | the new Service to use, ownership is not transferred.

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

- common/rpc/RpcChannel.h
- common/rpc/RpcChannel.cpp