GRPC C++  1.4.0
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions
grpc::ClientAsyncReaderWriter< W, R > Class Template Referencefinal

Async client-side interface for bi-directional streaming, where the outgoing message stream going to the server has messages of type W, and the incoming message stream coming from the server has messages of type R. More...

#include <async_stream.h>

Public Member Functions

void ReadInitialMetadata (void *tag) override
 See the ClientAsyncStreamingInterface.ReadInitialMetadata method for semantics of this method. More...
 
void Read (R *msg, void *tag) override
 Read a message of type R into msg. More...
 
void Write (const W &msg, void *tag) override
 Request the writing of msg with identifying tag tag. More...
 
void Write (const W &msg, WriteOptions options, void *tag) override
 Request the writing of msg using WriteOptions options with identifying tag tag. More...
 
void WritesDone (void *tag) override
 Signal the client is done with the writes (half-close the client stream). More...
 
void Finish (Status *status, void *tag) override
 See the ClientAsyncStreamingInterface.Finish method for semantics. More...
 
- Public Member Functions inherited from grpc::ClientAsyncStreamingInterface
virtual ~ClientAsyncStreamingInterface ()
 
- Public Member Functions inherited from grpc::AsyncWriterInterface< W >
virtual ~AsyncWriterInterface ()
 
void WriteLast (const W &msg, WriteOptions options, void *tag)
 Request the writing of msg and coalesce it with the writing of trailing metadata, using WriteOptions options with identifying tag tag. More...
 
- Public Member Functions inherited from grpc::AsyncReaderInterface< R >
virtual ~AsyncReaderInterface ()
 

Static Public Member Functions

static ClientAsyncReaderWriterCreate (ChannelInterface *channel, CompletionQueue *cq, const RpcMethod &method, ClientContext *context, void *tag)
 Create a stream and write the first request out. More...
 
static void operator delete (void *ptr, std::size_t size)
 

Detailed Description

template<class W, class R>
class grpc::ClientAsyncReaderWriter< W, R >

Async client-side interface for bi-directional streaming, where the outgoing message stream going to the server has messages of type W, and the incoming message stream coming from the server has messages of type R.

Member Function Documentation

template<class W , class R >
static ClientAsyncReaderWriter* grpc::ClientAsyncReaderWriter< W, R >::Create ( ChannelInterface channel,
CompletionQueue cq,
const RpcMethod method,
ClientContext context,
void *  tag 
)
inlinestatic

Create a stream and write the first request out.

tag will be notified on cq when the call has been started (i.e. intitial metadata sent). Note that context will be used to fill in custom initial metadata used to send to the server when starting the call.

template<class W , class R >
void grpc::ClientAsyncReaderWriter< W, R >::Finish ( Status status,
void *  tag 
)
inlineoverridevirtual

See the ClientAsyncStreamingInterface.Finish method for semantics.

Side effect

  • the ClientContext associated with this call is updated with possible initial and trailing metadata sent from the server.

Implements grpc::ClientAsyncStreamingInterface.

template<class W , class R >
static void grpc::ClientAsyncReaderWriter< W, R >::operator delete ( void *  ptr,
std::size_t  size 
)
inlinestatic
template<class W , class R >
void grpc::ClientAsyncReaderWriter< W, R >::Read ( R *  msg,
void *  tag 
)
inlineoverridevirtual

Read a message of type R into msg.

Completion will be notified by tag on the associated completion queue. This is thread-safe with respect to Write or WritesDone methods. It should not be called concurrently with other streaming APIs on the same stream. It is not meaningful to call it concurrently with another AsyncReaderInterface::Read on the same stream since reads on the same stream are delivered in order.

Parameters
[out]msgWhere to eventually store the read message.
[in]tagThe tag identifying the operation.

Side effect: note that this method attempt to receive initial metadata for a stream if it hasn't yet been received.

Implements grpc::AsyncReaderInterface< R >.

template<class W , class R >
void grpc::ClientAsyncReaderWriter< W, R >::ReadInitialMetadata ( void *  tag)
inlineoverridevirtual

See the ClientAsyncStreamingInterface.ReadInitialMetadata method for semantics of this method.

Side effect:

  • upon receiving initial metadata from the server, the ClientContext is updated with it, and then the receiving initial metadata can be accessed through this ClientContext.

Implements grpc::ClientAsyncStreamingInterface.

template<class W , class R >
void grpc::ClientAsyncReaderWriter< W, R >::Write ( const W &  msg,
void *  tag 
)
inlineoverridevirtual

Request the writing of msg with identifying tag tag.

Only one write may be outstanding at any given time. This means that after calling Write, one must wait to receive tag from the completion queue BEFORE calling Write again. This is thread-safe with respect to AsyncReaderInterface::Read

Parameters
[in]msgThe message to be written.
[in]tagThe tag identifying the operation.

Implements grpc::AsyncWriterInterface< W >.

template<class W , class R >
void grpc::ClientAsyncReaderWriter< W, R >::Write ( const W &  msg,
WriteOptions  options,
void *  tag 
)
inlineoverridevirtual

Request the writing of msg using WriteOptions options with identifying tag tag.

Only one write may be outstanding at any given time. This means that after calling Write, one must wait to receive tag from the completion queue BEFORE calling Write again. WriteOptions options is used to set the write options of this message. This is thread-safe with respect to AsyncReaderInterface::Read

Parameters
[in]msgThe message to be written.
[in]optionsThe WriteOptions to be used to write this message.
[in]tagThe tag identifying the operation.

Implements grpc::AsyncWriterInterface< W >.

template<class W , class R >
void grpc::ClientAsyncReaderWriter< W, R >::WritesDone ( void *  tag)
inlineoverridevirtual

Signal the client is done with the writes (half-close the client stream).

Thread-safe with respect to AsyncReaderInterface::Read

Parameters
[in]tagThe tag identifying the operation.

Implements grpc::ClientAsyncReaderWriterInterface< W, R >.


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