32 #ifndef GRPCXX_IMPL_CODEGEN_COMPLETION_QUEUE_H
33 #define GRPCXX_IMPL_CODEGEN_COMPLETION_QUEUE_H
50 template <
class W,
class R>
51 class ClientReaderWriter;
57 template <
class W,
class R>
60 template <
class ServiceType,
class RequestType,
class ResponseType>
62 template <
class ServiceType,
class RequestType,
class ResponseType>
64 template <
class ServiceType,
class RequestType,
class ResponseType>
66 template <
class ServiceType,
class RequestType,
class ResponseType>
122 template <
typename T>
125 return AsyncNextInternal(tag, ok, deadline_tp.
raw_time());
135 bool Next(
void** tag,
bool* ok) {
169 static_cast<gpr_atm>(1));
187 friend class ::grpc::ClientReader;
189 friend class ::grpc::ClientWriter;
190 template <
class W,
class R>
191 friend class ::grpc::ClientReaderWriter;
193 friend class ::grpc::ServerReader;
195 friend class ::grpc::ServerWriter;
196 template <
class W,
class R>
197 friend class ::grpc::internal::ServerReaderWriterBody;
198 template <
class ServiceType,
class RequestType,
class ResponseType>
200 template <
class ServiceType,
class RequestType,
class ResponseType>
202 template <
class ServiceType,
class RequestType,
class ResponseType>
204 template <
class Streamer,
bool WriteNeeded>
207 friend class ::grpc::Server;
208 friend class ::grpc::ServerContext;
209 template <
class InputMessage,
class OutputMessage>
213 const InputMessage& request,
214 OutputMessage* result);
224 cq_, tag, deadline,
nullptr);
230 return ev.success != 0;
244 cq_, tag, deadline,
nullptr);
257 void TryPluck(CompletionQueueTag* tag,
gpr_timespec deadline) {
259 cq_, tag, deadline,
nullptr);
290 polling_type_(polling_type) {}
295 #endif // GRPCXX_IMPL_CODEGEN_COMPLETION_QUEUE_H
An interface allowing implementors to process and filter event tags.
Definition: completion_queue_tag.h:25
virtual const grpc_completion_queue_factory * grpc_completion_queue_factory_lookup(const grpc_completion_queue_attributes *attributes)=0
friend Status BlockingUnaryCall(ChannelInterface *channel, const RpcMethod &method, ClientContext *context, const InputMessage &request, OutputMessage *result)
Wrapper that performs a blocking unary call.
Definition: client_unary_call.h:37
virtual gpr_timespec gpr_inf_future(gpr_clock_type type)=0
virtual bool FinalizeResult(void **tag, bool *status)=0
Called prior to returning from Next(), return value is the status of the operation (return status is ...
Definition: completion_queue.h:58
#define GPR_CODEGEN_ASSERT(x)
Codegen specific version of GPR_ASSERT.
Definition: core_codegen_interface.h:126
Got a new event; tag will be filled in with its associated value; ok indicating its success...
Definition: completion_queue.h:107
No event before timeout.
Definition: grpc_types.h:404
int success
If the grpc_completion_type is GRPC_OP_COMPLETE, this field indicates whether the operation was succe...
Definition: grpc_types.h:420
#define GRPC_CQ_CURRENT_VERSION
Definition: grpc_types.h:600
The completion queue has been shutdown.
Definition: completion_queue.h:106
Events are popped out by calling grpc_completion_queue_next() API ONLY.
Definition: grpc_types.h:594
gpr_timespec raw_time()
Definition: time.h:41
bool IsFrequentlyPolled()
Definition: completion_queue.h:278
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:37
If you are trying to use CompletionQueue::AsyncNext with a time class that isn't either gpr_timespec ...
Definition: time.h:38
Definition: grpc_types.h:601
grpc_completion_queue * cq()
Returns a raw pointer to the underlying grpc_completion_queue instance.
Definition: completion_queue.h:156
A ClientContext allows the person implementing a service client to:
Definition: client_context.h:153
Synchronous (blocking) server-side API for doing client-streaming RPCs, where the incoming message st...
Definition: completion_queue.h:53
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:135
void RegisterAvalanching()
Definition: completion_queue.h:167
Handle unknown method by returning UNIMPLEMENTED error.
Definition: method_handler_impl.h:244
grpc_cq_polling_type
Completion queues internally MAY maintain a set of file descriptors in a structure called 'pollset'...
Definition: grpc_types.h:574
CompletionQueue(const grpc_completion_queue_attributes &attributes)
Private constructor of CompletionQueue only visible to friend classes.
Definition: completion_queue.h:175
Shutting down.
Definition: grpc_types.h:402
#define gpr_atm_rel_store(p, value)
Definition: atm_gcc_atomic.h:47
A wrapper class of an application provided bidi-streaming handler.
Definition: method_handler_impl.h:165
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:123
~CompletionQueue()
Destructor. Destroys the owned wrapped completion queue / instance.
Definition: completion_queue.h:100
Represents a gRPC server.
Definition: server.h:52
A wrapper class of an application provided rpc method handler.
Definition: completion_queue.h:61
void Shutdown()
Request the shutdown of the queue.
virtual grpc_completion_queue * grpc_completion_queue_create(const grpc_completion_queue_factory *factory, const grpc_completion_queue_attributes *attributes, void *reserved)=0
void CompleteAvalanching()
#define gpr_atm_no_barrier_fetch_add(p, delta)
Definition: atm_gcc_atomic.h:52
Codegen interface for grpc::Channel.
Definition: channel_interface.h:49
CoreCodegenInterface * g_core_codegen_interface
Definition: call.h:49
NextStatus
Tri-state return for AsyncNext: SHUTDOWN, GOT_EVENT, TIMEOUT.
Definition: completion_queue.h:105
The completion queue will have an associated pollset and there is no restriction on the type of file ...
Definition: grpc_types.h:577
intptr_t gpr_atm
Definition: atm_gcc_atomic.h:26
Similar to GRPC_CQ_DEFAULT_POLLING except that the completion queues will not contain any 'listening ...
Definition: grpc_types.h:582
CompletionQueue()
Default constructor.
Definition: completion_queue.h:90
A ServerContext allows the person implementing a service handler to:
Definition: server_context.h:95
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:86
void InitialAvalanching()
Manage state of avalanching operations : completion queue tags that trigger other completion queue op...
Definition: completion_queue.h:164
A wrapper class of an application provided client streaming handler.
Definition: completion_queue.h:63
Descriptor of an RPC method.
Definition: rpc_method.h:29
Interface between the codegen library and the minimal subset of core features required by the generat...
Definition: core_codegen_interface.h:41
A wrapper class of an application provided server streaming handler.
Definition: completion_queue.h:65
Did it work? If it didn't, why?
Definition: status.h:30
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:276
struct grpc_completion_queue grpc_completion_queue
Completion Queues enable notification of the completion of asynchronous actions.
Definition: grpc_types.h:57
virtual gpr_timespec gpr_time_0(gpr_clock_type type)=0
Definition: completion_queue.h:67
A builder class for the creation and startup of grpc::Server instances.
Definition: server_builder.h:54
deadline was reached.
Definition: completion_queue.h:109
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:34