Go to the documentation of this file.
19 #ifndef GRPCPP_SERVER_INTERFACE_H
20 #define GRPCPP_SERVER_INTERFACE_H
22 #include "absl/log/absl_check.h"
39 class AsyncGenericService;
41 class CompletionQueue;
42 class GenericServerContext;
43 class ServerCompletionQueue;
44 class ServerCredentials;
51 class ServerAsyncStreamingInterface;
54 class CallbackGenericService;
56 namespace experimental {
57 class ServerInterceptorFactoryInterface;
58 class ServerMetricRecorder;
113 virtual void Wait() = 0;
170 bool delete_on_finalize);
176 void ContinueFinalizeResultAfterInterception();
202 void* tag,
const char* name,
213 *
server_->interceptor_creators()));
233 server, context, stream, call_cq, notification_cq, tag,
234 registered_method->name(), registered_method->method_type()) {
241 template <
class Message>
251 server, context, stream, call_cq, notification_cq, tag,
252 registered_method->name(), registered_method->method_type()),
253 registered_method_(registered_method),
270 payload_.bbuf_ptr(), request_)
277 "Unable to parse request",
nullptr);
305 bool delete_on_finalize,
bool issue_request =
true);
316 template <
class Message>
325 notification_cq, tag, message);
336 notification_cq, tag);
355 std::unique_ptr<experimental::ServerInterceptorFactoryInterface>>*
356 interceptor_creators() {
361 virtual bool call_metric_recording_enabled()
const = 0;
364 virtual experimental::ServerMetricRecorder* server_metric_recorder()
379 #endif // GRPCPP_SERVER_INTERFACE_H
Definition: server_interface.h:164
RegisteredAsyncRequest is not part of the C++ API.
Definition: server_interface.h:195
Definition: service_type.h:39
bool done_intercepting_
Definition: server_interface.h:189
Records server wide metrics to be reported to the client.
Definition: server_metric_recorder.h:42
A ServerContext or CallbackServerContext allows the code implementing a service handler to:
Definition: server_context.h:578
An Alarm posts the user-provided tag to its associated completion queue or invokes the user-provided ...
Definition: alarm.h:33
grpc::ServerCompletionQueue *const notification_cq_
Definition: server_interface.h:183
@ GPR_CLOCK_MONOTONIC
Monotonic clock.
Definition: time.h:34
~ServerInterface() override
Definition: server_interface.h:63
void Shutdown()
Shutdown the server without a deadline and forced cancellation.
Definition: server_interface.h:107
grpc::CompletionQueue *const call_cq_
Definition: server_interface.h:182
This is an interface that Channel and Server implement to allow them to hook performing ops.
Definition: call_hook.h:30
Definition: grpc_types.h:258
const char * name_
Definition: server_interface.h:220
Wrapper around grpc_server_credentials, a way to authenticate a server.
Definition: server_credentials.h:69
~PayloadAsyncRequest() override
Definition: server_interface.h:259
Straightforward wrapping of the C call object.
Definition: call.h:36
Definition: server_interface.h:242
virtual void ShutdownInternal(gpr_timespec deadline)=0
void RequestAsyncCall(internal::RpcServiceMethod *method, grpc::ServerContext *context, internal::ServerAsyncStreamingInterface *stream, grpc::CompletionQueue *call_cq, grpc::ServerCompletionQueue *notification_cq, void *tag)
Definition: server_interface.h:328
Descriptor of an RPC service and its various RPC methods.
Definition: service_type.h:58
virtual bool RegisterService(const std::string *host, Service *service)=0
Register a service.
virtual void RegisterCallbackGenericService(CallbackGenericService *)
Register a callback generic service.
Definition: server_interface.h:130
GPRAPI gpr_timespec gpr_inf_future(gpr_clock_type type)
The far future.
~BaseAsyncRequest() override
NoPayloadAsyncRequest(internal::RpcServiceMethod *registered_method, ServerInterface *server, grpc::ServerContext *context, internal::ServerAsyncStreamingInterface *stream, grpc::CompletionQueue *call_cq, grpc::ServerCompletionQueue *notification_cq, void *tag)
Definition: server_interface.h:226
void *const tag_
Definition: server_interface.h:184
grpc::ServerContext *const context_
Definition: server_interface.h:180
internal::Call call_wrapper_
Definition: server_interface.h:187
bool FinalizeResult(void **tag, bool *status) override
FinalizeResult must be called before informing user code that the operation bound to the underlying c...
@ GRPC_STATUS_INTERNAL
Internal errors.
Definition: status.h:129
bool FinalizeResult(void **tag, bool *status) override
FinalizeResult must be called before informing user code that the operation bound to the underlying c...
GRPCAPI void grpc_call_unref(grpc_call *call)
Unref a call.
PayloadAsyncRequest(internal::RpcServiceMethod *registered_method, ServerInterface *server, grpc::ServerContext *context, internal::ServerAsyncStreamingInterface *stream, grpc::CompletionQueue *call_cq, grpc::ServerCompletionQueue *notification_cq, void *tag, Message *request)
Definition: server_interface.h:244
struct grpc_call grpc_call
A Call represents an RPC.
Definition: grpc_types.h:69
Definition: grpc_types.h:42
An abstract collection of call ops, used to generate the grpc_call_op structure to pass down to the l...
Definition: call_op_set_interface.h:36
A sequence of bytes.
Definition: byte_buffer.h:60
const bool delete_on_finalize_
Definition: server_interface.h:185
virtual void RegisterAsyncGenericService(AsyncGenericService *service)=0
Register a generic service.
virtual grpc_server * server()=0
virtual int max_receive_message_size() const =0
void IssueRequest(void *registered_method, grpc_byte_buffer **payload, grpc::ServerCompletionQueue *notification_cq)
void PerformOpsOnCall(internal::CallOpSetInterface *ops, internal::Call *call) override=0
struct grpc_server grpc_server
A server listens to some port and responds to request calls.
Definition: grpc_types.h:64
Definition: server_interface.h:224
void Shutdown(const T &deadline)
Shutdown does the following things:
Definition: server_interface.h:98
Defines how to serialize and deserialize some type.
Definition: serialization_traits.h:58
grpc_call * call_
Definition: server_interface.h:186
Definition: async_generic_service.h:66
ServerInterface *const server_
Definition: server_interface.h:179
void * server_tag() const
Definition: rpc_service_method.h:105
RpcType
Definition: rpc_method.h:31
Definition: async_generic_service.h:37
An interface allowing implementors to process and filter event tags.
Definition: completion_queue_tag.h:26
void SetRecvMessage(void *message, bool *hijacked_recv_message_failed)
Definition: interceptor_common.h:170
const internal::RpcMethod::RpcType type_
Definition: server_interface.h:221
RegisteredAsyncRequest(ServerInterface *server, grpc::ServerContext *context, internal::ServerAsyncStreamingInterface *stream, grpc::CompletionQueue *call_cq, grpc::ServerCompletionQueue *notification_cq, void *tag, const char *name, internal::RpcMethod::RpcType type)
void RequestAsyncCall(internal::RpcServiceMethod *method, grpc::ServerContext *context, internal::ServerAsyncStreamingInterface *stream, grpc::CompletionQueue *call_cq, grpc::ServerCompletionQueue *notification_cq, void *tag, Message *message)
Definition: server_interface.h:317
void RequestAsyncGenericCall(GenericServerContext *context, internal::ServerAsyncStreamingInterface *stream, grpc::CompletionQueue *call_cq, grpc::ServerCompletionQueue *notification_cq, void *tag)
Definition: server_interface.h:339
virtual int AddListeningPort(const std::string &addr, ServerCredentials *creds)=0
Tries to bind server to the given addr.
bool FinalizeResult(void **tag, bool *status) override
FinalizeResult must be called before informing user code that the operation bound to the underlying c...
Definition: server_interface.h:205
A specific type of completion queue used by the processing of notifications by servers.
Definition: completion_queue.h:427
bool call_metric_recording_enabled_
Definition: server_interface.h:190
experimental::ServerMetricRecorder * server_metric_recorder_
Definition: server_interface.h:191
A thin wrapper around grpc_completion_queue (see src/core/lib/surface/completion_queue....
Definition: completion_queue.h:105
Definition: server_interface.h:299
bool Valid() const
Is this ByteBuffer valid?
Definition: byte_buffer.h:159
internal::ServerAsyncStreamingInterface *const stream_
Definition: server_interface.h:181
Server side rpc method class.
Definition: rpc_service_method.h:86
void Release()
Forget underlying byte buffer without destroying Use this only for un-owned byte buffers.
Definition: byte_buffer.h:144
Definition: server_interface.h:61
Analogous to struct timespec.
Definition: time.h:48
::google::protobuf::Message Message
Definition: config_protobuf.h:88
virtual void Wait()=0
Block waiting for all work to complete.
internal::InterceptorBatchMethodsImpl interceptor_methods_
Definition: server_interface.h:188
BaseAsyncRequest(ServerInterface *server, grpc::ServerContext *context, internal::ServerAsyncStreamingInterface *stream, grpc::CompletionQueue *call_cq, grpc::ServerCompletionQueue *notification_cq, void *tag, bool delete_on_finalize)
virtual void Start(grpc::ServerCompletionQueue **cqs, size_t num_cqs)=0
Start the server.
bool FinalizeResult(void **tag, bool *status) override
FinalizeResult must be called before informing user code that the operation bound to the underlying c...
Definition: server_interface.h:263
Definition: interceptor_common.h:38
GRPCAPI grpc_call_error grpc_call_cancel_with_status(grpc_call *call, grpc_status_code status, const char *description, void *reserved)
Cancel an RPC.
GenericAsyncRequest(ServerInterface *server, GenericServerContext *context, internal::ServerAsyncStreamingInterface *stream, grpc::CompletionQueue *call_cq, grpc::ServerCompletionQueue *notification_cq, void *tag, bool delete_on_finalize, bool issue_request=true)
If you are trying to use CompletionQueue::AsyncNext with a time class that isn't either gpr_timespec ...
Definition: time.h:40
void AddInterceptionHookPoint(experimental::InterceptionHookPoints type)
Definition: interceptor_common.h:80
CallbackGenericService is the base class for generic services implemented using the callback API and ...
Definition: callback_generic_service.h:51