32 #ifndef GRPCPP_IMPL_CODEGEN_COMPLETION_QUEUE_IMPL_H 33 #define GRPCPP_IMPL_CODEGEN_COMPLETION_QUEUE_IMPL_H 54 template <
class W,
class R>
61 template <
class W,
class R>
67 class ChannelInterface;
68 class ServerInterface;
71 class CompletionQueueTag;
73 template <
class ServiceType,
class RequestType,
class ResponseType>
74 class RpcMethodHandler;
75 template <
class ServiceType,
class RequestType,
class ResponseType>
77 template <
class ServiceType,
class RequestType,
class ResponseType>
79 template <
class ServiceType,
class RequestType,
class ResponseType>
81 template <
class Streamer,
bool WriteNeeded>
83 template <StatusCode code>
85 template <
class InputMessage,
class OutputMessage>
87 template <
class Op1,
class Op2,
class Op3,
class Op4,
class Op5,
class Op6>
176 bool Next(
void** tag,
bool* ok) {
177 return (AsyncNextInternal(tag, ok,
193 template <
typename T>
196 return AsyncNextInternal(tag, ok, deadline_tp.
raw_time());
213 template <
typename T,
typename F>
215 CompletionQueueTLSCache cache = CompletionQueueTLSCache(
this);
217 if (cache.Flush(tag, ok)) {
220 return AsyncNext(tag, ok, deadline);
250 InitialAvalanching();
260 template <
class W,
class R>
266 template <
class W,
class R>
267 friend class ::grpc_impl::internal::ServerReaderWriterBody;
268 template <
class ServiceType,
class RequestType,
class ResponseType>
269 friend class ::grpc::internal::RpcMethodHandler;
270 template <
class ServiceType,
class RequestType,
class ResponseType>
271 friend class ::grpc::internal::ClientStreamingHandler;
272 template <
class ServiceType,
class RequestType,
class ResponseType>
273 friend class ::grpc::internal::ServerStreamingHandler;
274 template <
class Streamer,
bool WriteNeeded>
275 friend class ::grpc::internal::TemplatedBidiStreamingHandler;
276 template <::grpc::StatusCode code>
277 friend class ::grpc::internal::ErrorMethodHandler;
280 friend class ::grpc::ServerInterface;
281 template <
class InputMessage,
class OutputMessage>
282 friend class ::grpc::internal::BlockingUnaryCallImpl;
288 template <
class Op1,
class Op2,
class Op3,
class Op4,
class Op5,
class Op6>
289 friend class ::grpc::internal::CallOpSet;
295 class CompletionQueueTLSCache {
298 ~CompletionQueueTLSCache();
299 bool Flush(
void** tag,
bool* ok);
315 cq_, tag, deadline,
nullptr);
337 cq_, tag, deadline,
nullptr);
353 cq_, tag, deadline,
nullptr);
369 void InitialAvalanching() {
372 void RegisterAvalanching() {
374 static_cast<gpr_atm>(1));
376 void CompleteAvalanching() {
378 static_cast<gpr_atm>(-1)) == 1) {
411 polling_type_(polling_type) {}
420 #endif // GRPCPP_IMPL_CODEGEN_COMPLETION_QUEUE_IMPL_H A wrapper class of an application provided server streaming handler.
Definition: byte_buffer.h:58
~CompletionQueue()
Destructor. Destroys the owned wrapped completion queue / instance.
Definition: completion_queue_impl.h:116
A wrapper class of an application provided bidi-streaming handler.
Definition: completion_queue_impl.h:82
NextStatus DoThenAsyncNext(F &&f, void **tag, bool *ok, const T &deadline)
EXPERIMENTAL First executes F, then reads from the queue, blocking up to deadline (or the queue's shu...
Definition: completion_queue_impl.h:214
#define GPR_CODEGEN_ASSERT(x)
Codegen specific version of GPR_ASSERT.
Definition: core_codegen_interface.h:145
virtual void grpc_completion_queue_shutdown(grpc_completion_queue *cq)=0
virtual gpr_timespec gpr_inf_future(gpr_clock_type type)=0
bool Next(void **tag, bool *ok)
Read from the queue, blocking until an event is available or the queue is shutting down...
Definition: completion_queue_impl.h:176
grpc_completion_queue * cq()
Returns a raw pointer to the underlying grpc_completion_queue instance.
Definition: completion_queue_impl.h:241
bool IsFrequentlyPolled()
Definition: completion_queue_impl.h:392
An interface allowing implementors to process and filter event tags.
Definition: completion_queue_tag.h:26
::grpc_impl::Server Server
Definition: server.h:26
virtual bool FinalizeResult(void **tag, bool *status)=0
FinalizeResult must be called before informing user code that the operation bound to the underlying c...
Primary implementation of CallOpSetInterface.
Definition: call_op_set.h:821
No event before timeout.
Definition: grpc_types.h:490
ServerCompletionQueue()
Default constructor.
Definition: completion_queue_impl.h:396
GPRAPI gpr_timespec gpr_inf_future(gpr_clock_type type)
The zero time interval.
int success
If the grpc_completion_type is GRPC_OP_COMPLETE, this field indicates whether the operation was succe...
Definition: grpc_types.h:506
CompletionQueue(const grpc_completion_queue_attributes &attributes)
Private constructor of CompletionQueue only visible to friend classes.
Definition: completion_queue_impl.h:245
The completion queue has been shutdown and fully-drained.
Definition: completion_queue_impl.h:122
#define GRPC_CQ_CURRENT_VERSION
Definition: grpc_types.h:720
Definition: completion_queue_impl.h:62
Events are popped out by calling grpc_completion_queue_next() API ONLY.
Definition: grpc_types.h:692
gpr_timespec raw_time()
Definition: time.h:43
virtual void grpc_completion_queue_destroy(grpc_completion_queue *cq)=0
Classes that require gRPC to be initialized should inherit from this class.
Definition: grpc_library.h:38
If you are trying to use CompletionQueue::AsyncNext with a time class that isn't either gpr_timespec ...
Definition: time.h:40
::grpc_impl::ServerContext ServerContext
Definition: server_context.h:25
Definition: grpc_types.h:722
::grpc_impl::ServerCompletionQueue ServerCompletionQueue
Definition: completion_queue.h:27
grpc_cq_completion_type
Specifies the type of APIs to use to pop events from the completion queue.
Definition: grpc_types.h:690
grpc_cq_polling_type
Completion queues internally MAY maintain a set of file descriptors in a structure called 'pollset'...
Definition: grpc_types.h:672
NextStatus
Tri-state return for AsyncNext: SHUTDOWN, GOT_EVENT, TIMEOUT.
Definition: completion_queue_impl.h:121
Synchronous (blocking) server-side API for doing client-streaming RPCs, where the incoming message st...
Definition: completion_queue_impl.h:57
Shutting down.
Definition: grpc_types.h:488
::grpc_impl::Channel Channel
Definition: channel.h:26
::grpc_impl::ServerReader< R > ServerReader
Definition: sync_stream.h:75
#define gpr_atm_rel_store(p, value)
Definition: atm_gcc_atomic.h:52
::grpc_impl::CompletionQueue CompletionQueue
Definition: completion_queue.h:26
Synchronous (blocking) server-side API for doing for doing a server-streaming RPCs, where the outgoing message stream coming from the server has messages of type W.
Definition: completion_queue_impl.h:59
::grpc_impl::ClientReaderWriter< W, R > ClientReaderWriter
Definition: sync_stream.h:69
This header provides an object that reads bytes directly from a grpc::ByteBuffer, via the ZeroCopyInp...
Definition: alarm.h:24
virtual grpc_completion_queue * grpc_completion_queue_create(const grpc_completion_queue_factory *factory, const grpc_completion_queue_attributes *attributes, void *reserved)=0
A wrapper class of an application provided client streaming handler.
Definition: completion_queue_impl.h:76
#define gpr_atm_no_barrier_fetch_add(p, delta)
Definition: atm_gcc_atomic.h:57
GRPCAPI const grpc_completion_queue_factory * grpc_completion_queue_factory_lookup(const grpc_completion_queue_attributes *attributes)
Returns the completion queue factory based on the attributes.
CoreCodegenInterface * g_core_codegen_interface
Definition: completion_queue_impl.h:91
The completion queue will have an associated pollset and there is no restriction on the type of file ...
Definition: grpc_types.h:675
intptr_t gpr_atm
Definition: atm_gcc_atomic.h:30
Similar to GRPC_CQ_DEFAULT_POLLING except that the completion queues will not contain any 'listening ...
Definition: grpc_types.h:680
::grpc_impl::ClientWriter< W > ClientWriter
Definition: sync_stream.h:62
Realtime clock.
Definition: gpr_types.h:36
An Alarm posts the user-provided tag to its associated completion queue or invokes the user-provided ...
Definition: alarm_impl.h:33
::grpc_impl::ServerBuilder ServerBuilder
Definition: server_builder.h:26
Definition: channel_interface.h:66
Interface between the codegen library and the minimal subset of core features required by the generat...
Definition: core_codegen_interface.h:38
A thin wrapper around grpc_completion_queue (see src/core/lib/surface/completion_queue.h).
Definition: completion_queue_impl.h:101
General method handler class for errors that prevent real method use e.g., handle unknown method by r...
Definition: byte_buffer.h:60
Analogous to struct timespec.
Definition: gpr_types.h:47
::grpc_impl::ServerWriter< W > ServerWriter
Definition: sync_stream.h:81
CompletionQueue()
Default constructor.
Definition: completion_queue_impl.h:105
A specific type of completion queue used by the processing of notifications by servers.
Definition: completion_queue_impl.h:390
Definition: completion_queue_impl.h:80
struct grpc_completion_queue grpc_completion_queue
Completion Queues enable notification of the completion of asynchronous actions.
Definition: grpc_types.h:56
virtual gpr_timespec gpr_time_0(gpr_clock_type type)=0
EXPERIMENTAL: Specifies an interface class to be used as a tag for callback-based completion queues...
Definition: grpc_types.h:706
NextStatus AsyncNext(void **tag, bool *ok, const T &deadline)
Read from the queue, blocking up to deadline (or the queue's shutdown).
Definition: completion_queue_impl.h:194
::grpc_impl::ClientReader< R > ClientReader
Definition: sync_stream.h:56
virtual grpc_event grpc_completion_queue_pluck(grpc_completion_queue *cq, void *tag, gpr_timespec deadline, void *reserved)=0