class CompletionQueue

Defined at line 105 of file ../../third_party/grpc-migrating/src/include/grpcpp/completion_queue.h

A thin wrapper around

(see

See

for notes on best practices for high

performance servers.

Public Methods

void CompletionQueue ()

Default constructor. Implicitly creates a

instance.

Defined at line 109 of file ../../third_party/grpc-migrating/src/include/grpcpp/completion_queue.h

void CompletionQueue (grpc_completion_queue * take)

Wrap

taking ownership of the instance.

Parameters

take The completion queue instance to wrap. Ownership is taken.
void ~CompletionQueue ()

Destructor. Destroys the owned wrapped completion queue / instance.

Defined at line 120 of file ../../third_party/grpc-migrating/src/include/grpcpp/completion_queue.h

bool Next (void ** tag, bool * ok)

Read from the queue, blocking until an event is available or the queue is

shutting down.

Note that each tag sent to the completion queue (through RPC operations

or alarms) will be delivered out of the completion queue by a call to

Next (or a related method), regardless of whether the operation succeeded

or not. Success here means that this operation completed in the normal

valid manner.

Server-side RPC request:

indicates that the RPC has indeed

been started. If it is false, the server has been Shutdown

before this particular call got matched to an incoming RPC.

Client-side StartCall/RPC invocation:

indicates that the RPC is

going to go to the wire. If it is false, it not going to the wire. This

would happen if the channel is either permanently broken or

transiently broken but with the fail-fast option. (Note that async unary

RPCs don't post a CQ tag at this point, nor do client-streaming

or bidi-streaming RPCs that have the initial metadata corked option set.)

Client-side Write, Client-side WritesDone, Server-side Write,

Server-side Finish, Server-side SendInitialMetadata (which is

typically included in Write or Finish when not done explicitly):

means that the data/metadata/status/etc is going to go to the

wire. If it is false, it not going to the wire because the call

is already dead (i.e., canceled, deadline expired, other side

dropped the channel, etc).

Client-side Read, Server-side Read, Client-side

RecvInitialMetadata (which is typically included in Read if not

done explicitly):

indicates whether there is a valid message

that got read. If not, you know that there are certainly no more

messages that can ever be read from this stream. For the client-side

operations, this only happens because the call is dead. For the

server-sider operation, though, this could happen because the client

has done a WritesDone already.

Client-side Finish:

should always be true

Server-side AsyncNotifyWhenDone:

should always be true

Alarm:

is true if it expired, false if it was canceled

Parameters

tag [out] Updated to point to the read event's tag.
ok [out] true if read a successful event, false otherwise.

Returns

true if got an event, false if the queue is fully drained and

shut down.

Defined at line 178 of file ../../third_party/grpc-migrating/src/include/grpcpp/completion_queue.h

template <typename T>
NextStatus AsyncNext (void ** tag, bool * ok, const T & deadline)

Read from the queue, blocking up to

(or the queue's shutdown).

Both

and

are updated upon success (if an event is available

within the

A

points to an arbitrary location usually

employed to uniquely identify an event.

Parameters

tag [out] Upon success, updated to point to the event's tag.
ok [out] Upon success, true if a successful event, false otherwise See documentation for CompletionQueue::Next for explanation of ok
deadline [in] How long to block in wait for an event.

Returns

The type of event read.

Defined at line 200 of file ../../third_party/grpc-migrating/src/include/grpcpp/completion_queue.h

template <typename T, typename F>
NextStatus DoThenAsyncNext (F && f, void ** tag, bool * ok, const T & deadline)

EXPERIMENTAL

First executes

then reads from the queue, blocking up to

(or the queue's shutdown).

Both

and

are updated upon success (if an event is available

within the

A

points to an arbitrary location usually

employed to uniquely identify an event.

Parameters

f [in] Function to execute before calling AsyncNext on this queue.
tag [out] Upon success, updated to point to the event's tag.
ok [out] Upon success, true if read a regular event, false otherwise.
deadline [in] How long to block in wait for an event.

Returns

The type of event read.

Defined at line 220 of file ../../third_party/grpc-migrating/src/include/grpcpp/completion_queue.h

void Shutdown ()

Request the shutdown of the queue.

grpc_completion_queue * cq ()

Returns a

pointer to the underlying

instance.

Defined at line 247 of file ../../third_party/grpc-migrating/src/include/grpcpp/completion_queue.h

Protected Methods

void CompletionQueue (const grpc_completion_queue_attributes & attributes)

Private constructor of CompletionQueue only visible to friend classes

Defined at line 251 of file ../../third_party/grpc-migrating/src/include/grpcpp/completion_queue.h

Enumerations

enum NextStatus
Name Value
SHUTDOWN 0
GOT_EVENT 1
TIMEOUT 2

Tri-state return for AsyncNext: SHUTDOWN, GOT_EVENT, TIMEOUT.

Defined at line 123 of file ../../third_party/grpc-migrating/src/include/grpcpp/completion_queue.h

Friends

template <class Op1, class Op2, class Op3, class Op4, class Op5, class Op6>
class CallOpSet
class Channel
template <class InputMessage, class OutputMessage>
class BlockingUnaryCallImpl
class ServerInterface
class ServerContextBase
template <grpc::StatusCode code>
class ErrorMethodHandler
template <class Streamer, bool WriteNeeded>
class TemplatedBidiStreamingHandler
template <class ServiceType, class RequestType, class ResponseType>
class ServerStreamingHandler
template <class ServiceType, class RequestType, class ResponseType>
class ClientStreamingHandler
template <class ResponseType>
void CompletionQueue (const grpc::internal::MethodHandler::HandlerParameter & , ResponseType * , grpc::Status & )
template <class W, class R>
class ServerReaderWriterBody
template <class W>
class ServerWriter
template <class R>
class ServerReader
template <class W, class R>
class ClientReaderWriter
template <class W>
class ClientWriter
template <class R>
class ClientReader
class Server
class ServerBuilder