#include <completion_queue.h>
Classes | |
class | CompletionQueueTLSCache |
Public Types | |
enum | NextStatus { SHUTDOWN, GOT_EVENT, TIMEOUT } |
Tri-state return for AsyncNext: SHUTDOWN, GOT_EVENT, TIMEOUT. More... | |
Public Member Functions | |
template<typename T > | |
NextStatus | AsyncNext (void **tag, bool *ok, const T &deadline) |
CompletionQueue () | |
CompletionQueue (grpc_completion_queue *take) | |
grpc_completion_queue * | cq () |
template<typename T , typename F > | |
NextStatus | DoThenAsyncNext (F &&f, void **tag, bool *ok, const T &deadline) |
bool | Next (void **tag, bool *ok) |
void | Shutdown () |
~CompletionQueue () override | |
Destructor. Destroys the owned wrapped completion queue / instance. More... | |
Protected Member Functions | |
CompletionQueue (const grpc_completion_queue_attributes &attributes) | |
Private constructor of CompletionQueue only visible to friend classes. More... | |
Private Member Functions | |
NextStatus | AsyncNextInternal (void **tag, bool *ok, gpr_timespec deadline) |
void | CompleteAvalanching () |
void | InitialAvalanching () |
bool | Pluck (grpc::internal::CompletionQueueTag *tag) |
void | RegisterAvalanching () |
void | RegisterServer (const grpc::Server *server) |
bool | ServerListEmpty () const |
void | TryPluck (grpc::internal::CompletionQueueTag *tag) |
void | TryPluck (grpc::internal::CompletionQueueTag *tag, gpr_timespec deadline) |
void | UnregisterServer (const grpc::Server *server) |
![]() | |
GrpcLibraryCodegen (bool call_grpc_init=true) | |
virtual | ~GrpcLibraryCodegen () |
Static Private Member Functions | |
static CompletionQueue * | CallbackAlternativeCQ () |
static void | ReleaseCallbackAlternativeCQ (CompletionQueue *cq) |
Private Attributes | |
gpr_atm | avalanches_in_flight_ |
grpc_completion_queue * | cq_ |
std::list< const grpc::Server * > | server_list_ |
grpc::internal::Mutex | server_list_mutex_ |
Friends | |
class | grpc::Channel |
template<class R > | |
class | grpc::ClientReader |
template<class W , class R > | |
class | grpc::ClientReaderWriter |
template<class W > | |
class | grpc::ClientWriter |
template<class InputMessage , class OutputMessage > | |
class | grpc::internal::BlockingUnaryCallImpl |
template<class Op1 , class Op2 , class Op3 , class Op4 , class Op5 , class Op6 > | |
class | grpc::internal::CallOpSet |
template<class ServiceType , class RequestType , class ResponseType > | |
class | grpc::internal::ClientStreamingHandler |
template<grpc::StatusCode code> | |
class | grpc::internal::ErrorMethodHandler |
template<class W , class R > | |
class | grpc::internal::ServerReaderWriterBody |
template<class ServiceType , class RequestType , class ResponseType > | |
class | grpc::internal::ServerStreamingHandler |
template<class Streamer , bool WriteNeeded> | |
class | grpc::internal::TemplatedBidiStreamingHandler |
template<class ResponseType > | |
void | grpc::internal::UnaryRunHandlerHelper (const grpc::internal::MethodHandler::HandlerParameter &, ResponseType *, grpc::Status &) |
class | grpc::Server |
class | grpc::ServerBuilder |
class | grpc::ServerContextBase |
class | grpc::ServerInterface |
template<class R > | |
class | grpc::ServerReader |
template<class W > | |
class | grpc::ServerWriter |
A thin wrapper around grpc_completion_queue (see src/core/lib/surface/completion_queue.h). See doc/cpp/perf_notes.md for notes on best practices for high performance servers.
Definition at line 104 of file include/grpcpp/impl/codegen/completion_queue.h.
Tri-state return for AsyncNext: SHUTDOWN, GOT_EVENT, TIMEOUT.
Definition at line 124 of file include/grpcpp/impl/codegen/completion_queue.h.
|
inline |
Default constructor. Implicitly creates a grpc_completion_queue instance.
Definition at line 108 of file include/grpcpp/impl/codegen/completion_queue.h.
|
explicit |
Wrap take, taking ownership of the instance.
take | The completion queue instance to wrap. Ownership is taken. |
Definition at line 132 of file completion_queue_cc.cc.
|
inlineoverride |
Destructor. Destroys the owned wrapped completion queue / instance.
Definition at line 119 of file include/grpcpp/impl/codegen/completion_queue.h.
|
inlineexplicitprotected |
Private constructor of CompletionQueue only visible to friend classes.
Definition at line 253 of file include/grpcpp/impl/codegen/completion_queue.h.
|
inline |
Read from the queue, blocking up to deadline (or the queue's shutdown). Both tag and ok are updated upon success (if an event is available within the deadline). A tag points to an arbitrary location usually employed to uniquely identify an event.
[out] | tag | Upon success, updated to point to the event's tag. |
[out] | ok | Upon success, true if a successful event, false otherwise See documentation for CompletionQueue::Next for explanation of ok |
[in] | deadline | How long to block in wait for an event. |
Definition at line 202 of file include/grpcpp/impl/codegen/completion_queue.h.
|
private |
Definition at line 148 of file completion_queue_cc.cc.
|
staticprivate |
Definition at line 196 of file completion_queue_cc.cc.
|
inlineprivate |
Definition at line 390 of file include/grpcpp/impl/codegen/completion_queue.h.
|
inline |
Returns a raw pointer to the underlying grpc_completion_queue instance.
Definition at line 249 of file include/grpcpp/impl/codegen/completion_queue.h.
|
inline |
EXPERIMENTAL First executes F, then reads from the queue, blocking up to deadline (or the queue's shutdown). Both tag and ok are updated upon success (if an event is available within the deadline). A tag points to an arbitrary location usually employed to uniquely identify an event.
[in] | f | Function to execute before calling AsyncNext on this queue. |
[out] | tag | Upon success, updated to point to the event's tag. |
[out] | ok | Upon success, true if read a regular event, false otherwise. |
[in] | deadline | How long to block in wait for an event. |
Definition at line 222 of file include/grpcpp/impl/codegen/completion_queue.h.
|
inlineprivate |
Manage state of avalanching operations : completion queue tags that trigger other completion queue operations. The underlying core completion queue should not really shutdown until all avalanching operations have been finalized. Note that we maintain the requirement that an avalanche registration must take place before CQ shutdown (which must be maintained elsehwere)
Definition at line 383 of file include/grpcpp/impl/codegen/completion_queue.h.
Read from the queue, blocking until an event is available or the queue is shutting down.
[out] | tag | Updated to point to the read event's tag. |
[out] | ok | true if read a successful event, false otherwise. |
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: ok 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: ok 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): ok 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): ok 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: ok should always be true
Server-side AsyncNotifyWhenDone: ok should always be true
Alarm: ok is true if it expired, false if it was canceled
Definition at line 179 of file include/grpcpp/impl/codegen/completion_queue.h.
|
inlineprivate |
Wraps grpc_completion_queue_pluck.
Definition at line 324 of file include/grpcpp/impl/codegen/completion_queue.h.
|
inlineprivate |
Definition at line 386 of file include/grpcpp/impl/codegen/completion_queue.h.
|
inlineprivate |
Definition at line 397 of file include/grpcpp/impl/codegen/completion_queue.h.
|
staticprivate |
Definition at line 202 of file completion_queue_cc.cc.
|
inlineprivate |
Definition at line 411 of file include/grpcpp/impl/codegen/completion_queue.h.
void grpc::CompletionQueue::Shutdown | ( | ) |
Request the shutdown of the queue.
Definition at line 137 of file completion_queue_cc.cc.
|
inlineprivate |
Performs a single polling pluck on tag.
TODO: sreek - This calls tag->FinalizeResult() even if the cq_ is already shutdown. This is most likely a bug and if it is a bug, then change this implementation to simple call the other TryPluck function with a zero timeout. i.e: TryPluck(tag, gpr_time_0(GPR_CLOCK_REALTIME))
Definition at line 347 of file include/grpcpp/impl/codegen/completion_queue.h.
|
inlineprivate |
Performs a single polling pluck on tag. Calls tag->FinalizeResult if the pluck() was successful and returned the tag.
This exects tag->FinalizeResult (if called) to return 'false' i.e expects that the tag is internal not something that is returned to the user.
Definition at line 364 of file include/grpcpp/impl/codegen/completion_queue.h.
|
inlineprivate |
Definition at line 404 of file include/grpcpp/impl/codegen/completion_queue.h.
|
friend |
Definition at line 299 of file include/grpcpp/impl/codegen/completion_queue.h.
|
friend |
Definition at line 270 of file include/grpcpp/impl/codegen/completion_queue.h.
|
friend |
Definition at line 274 of file include/grpcpp/impl/codegen/completion_queue.h.
|
friend |
Definition at line 272 of file include/grpcpp/impl/codegen/completion_queue.h.
|
friend |
Definition at line 296 of file include/grpcpp/impl/codegen/completion_queue.h.
|
friend |
Definition at line 303 of file include/grpcpp/impl/codegen/completion_queue.h.
|
friend |
Definition at line 286 of file include/grpcpp/impl/codegen/completion_queue.h.
|
friend |
Definition at line 292 of file include/grpcpp/impl/codegen/completion_queue.h.
|
friend |
Definition at line 280 of file include/grpcpp/impl/codegen/completion_queue.h.
|
friend |
Definition at line 288 of file include/grpcpp/impl/codegen/completion_queue.h.
|
friend |
Definition at line 290 of file include/grpcpp/impl/codegen/completion_queue.h.
|
friend |
|
friend |
Definition at line 265 of file include/grpcpp/impl/codegen/completion_queue.h.
|
friend |
Definition at line 264 of file include/grpcpp/impl/codegen/completion_queue.h.
|
friend |
Definition at line 293 of file include/grpcpp/impl/codegen/completion_queue.h.
|
friend |
Definition at line 294 of file include/grpcpp/impl/codegen/completion_queue.h.
|
friend |
Definition at line 276 of file include/grpcpp/impl/codegen/completion_queue.h.
|
friend |
Definition at line 278 of file include/grpcpp/impl/codegen/completion_queue.h.
|
private |
Definition at line 424 of file include/grpcpp/impl/codegen/completion_queue.h.
|
private |
Definition at line 422 of file include/grpcpp/impl/codegen/completion_queue.h.
|
private |
Definition at line 431 of file include/grpcpp/impl/codegen/completion_queue.h.
|
mutableprivate |
Definition at line 429 of file include/grpcpp/impl/codegen/completion_queue.h.