32 #ifndef GRPCPP_IMPL_CODEGEN_COMPLETION_QUEUE_H 33 #define GRPCPP_IMPL_CODEGEN_COMPLETION_QUEUE_H 50 template <
class W,
class R>
51 class ClientReaderWriter;
57 template <
class W,
class R>
73 template <
class ServiceType,
class RequestType,
class ResponseType>
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>
170 bool Next(
void** tag,
bool* ok) {
171 return (AsyncNextInternal(tag, ok,
187 template <
typename T>
190 return AsyncNextInternal(tag, ok, deadline_tp.
raw_time());
206 template <
typename T,
typename F>
208 CompletionQueueTLSCache cache = CompletionQueueTLSCache(
this);
210 if (cache.Flush(tag, ok)) {
213 return AsyncNext(tag, ok, deadline);
243 InitialAvalanching();
250 friend class ::grpc::ClientReader;
252 friend class ::grpc::ClientWriter;
253 template <
class W,
class R>
254 friend class ::grpc::ClientReaderWriter;
256 friend class ::grpc::ServerReader;
258 friend class ::grpc::ServerWriter;
259 template <
class W,
class R>
260 friend class ::grpc::internal::ServerReaderWriterBody;
261 template <
class ServiceType,
class RequestType,
class ResponseType>
262 friend class ::grpc::internal::RpcMethodHandler;
263 template <
class ServiceType,
class RequestType,
class ResponseType>
264 friend class ::grpc::internal::ClientStreamingHandler;
265 template <
class ServiceType,
class RequestType,
class ResponseType>
266 friend class ::grpc::internal::ServerStreamingHandler;
267 template <
class Streamer,
bool WriteNeeded>
268 friend class ::grpc::internal::TemplatedBidiStreamingHandler;
269 template <StatusCode code>
270 friend class ::grpc::internal::ErrorMethodHandler;
271 friend class ::grpc::Server;
272 friend class ::grpc::ServerContext;
273 friend class ::grpc::ServerInterface;
274 template <
class InputMessage,
class OutputMessage>
275 friend class ::grpc::internal::BlockingUnaryCallImpl;
278 friend class ::grpc::Channel;
284 class CompletionQueueTLSCache {
287 ~CompletionQueueTLSCache();
288 bool Flush(
void** tag,
bool* ok);
303 cq_, tag, deadline,
nullptr);
309 return ev.success != 0;
323 cq_, tag, deadline,
nullptr);
338 cq_, tag, deadline,
nullptr);
354 void InitialAvalanching() {
357 void RegisterAvalanching() {
359 static_cast<gpr_atm>(1));
361 void CompleteAvalanching();
386 polling_type_(polling_type) {}
394 #endif // GRPCPP_IMPL_CODEGEN_COMPLETION_QUEUE_H A wrapper class of an application provided server streaming handler.
Definition: byte_buffer.h:47
virtual const grpc_completion_queue_factory * grpc_completion_queue_factory_lookup(const grpc_completion_queue_attributes *attributes)=0
A wrapper class of an application provided bidi-streaming handler.
Definition: completion_queue.h:82
#define GPR_CODEGEN_ASSERT(x)
Codegen specific version of GPR_ASSERT.
Definition: core_codegen_interface.h:138
virtual gpr_timespec gpr_inf_future(gpr_clock_type type)=0
Definition: completion_queue.h:58
An interface allowing implementors to process and filter event tags.
Definition: completion_queue_tag.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...
No event before timeout.
Definition: grpc_types.h:453
int success
If the grpc_completion_type is GRPC_OP_COMPLETE, this field indicates whether the operation was succe...
Definition: grpc_types.h:469
#define GRPC_CQ_CURRENT_VERSION
Definition: grpc_types.h:665
The completion queue has been shutdown and fully-drained.
Definition: completion_queue.h:116
Events are popped out by calling grpc_completion_queue_next() API ONLY.
Definition: grpc_types.h:654
gpr_timespec raw_time()
Definition: time.h:43
bool IsFrequentlyPolled()
Definition: completion_queue.h:372
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
Definition: grpc_types.h:667
grpc_completion_queue * cq()
Returns a raw pointer to the underlying grpc_completion_queue instance.
Definition: completion_queue.h:234
A ClientContext allows the person implementing a service client to:
Definition: client_context.h:164
Synchronous (blocking) server-side API for doing client-streaming RPCs, where the incoming message st...
Definition: completion_queue.h:53
ServerCompletionQueue()
Default constructor.
Definition: completion_queue.h:376
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.h:170
Descriptor of an RPC method.
Definition: rpc_method.h:29
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.h:207
grpc_cq_polling_type
Completion queues internally MAY maintain a set of file descriptors in a structure called 'pollset'...
Definition: grpc_types.h:634
CompletionQueue(const grpc_completion_queue_attributes &attributes)
Private constructor of CompletionQueue only visible to friend classes.
Definition: completion_queue.h:238
Shutting down.
Definition: grpc_types.h:451
#define gpr_atm_rel_store(p, value)
Definition: atm_gcc_atomic.h:52
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.h:188
~CompletionQueue()
Destructor. Destroys the owned wrapped completion queue / instance.
Definition: completion_queue.h:110
Represents a gRPC server.
Definition: server.h:52
An Alarm posts the user provided tag to its associated completion queue upon expiry or cancellation...
Definition: alarm.h:31
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.h:76
#define gpr_atm_no_barrier_fetch_add(p, delta)
Definition: atm_gcc_atomic.h:57
Codegen interface for grpc::Channel.
Definition: channel_interface.h:57
A wrapper class of an application provided rpc method handler.
Definition: byte_buffer.h:45
CoreCodegenInterface * g_core_codegen_interface
Definition: call.h:46
NextStatus
Tri-state return for AsyncNext: SHUTDOWN, GOT_EVENT, TIMEOUT.
Definition: completion_queue.h:115
The completion queue will have an associated pollset and there is no restriction on the type of file ...
Definition: grpc_types.h:637
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:642
CompletionQueue()
Default constructor.
Definition: completion_queue.h:99
A ServerContext allows the person implementing a service handler to:
Definition: server_context.h:97
Definition: server_interface.h:48
Realtime clock.
Definition: gpr_types.h:36
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.h:55
A thin wrapper around grpc_completion_queue (see src/core/lib/surface/completion_queue.h).
Definition: completion_queue.h:95
Definition: channel_interface.h:43
Interface between the codegen library and the minimal subset of core features required by the generat...
Definition: core_codegen_interface.h:37
General method handler class for errors that prevent real method use e.g., handle unknown method by r...
Definition: byte_buffer.h:49
Analogous to struct timespec.
Definition: gpr_types.h:47
A specific type of completion queue used by the processing of notifications by servers.
Definition: completion_queue.h:370
Definition: completion_queue.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
A builder class for the creation and startup of grpc::Server instances.
Definition: server_builder.h:52
virtual grpc_event grpc_completion_queue_pluck(grpc_completion_queue *cq, void *tag, gpr_timespec deadline, void *reserved)=0
Channels represent a connection to an endpoint. Created by CreateChannel.
Definition: channel.h:42