diff options
author | Craig Tiller <ctiller@google.com> | 2016-04-04 08:10:47 -0700 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2016-04-04 08:10:47 -0700 |
commit | 06cb1a9d938b566f79e59e5e9ba31979e13274ba (patch) | |
tree | 4033dcf85a479bd7004c3eb852bf9d0187b756e9 /include | |
parent | 307a7207a00b1ea34f6f5edbfd3e46faf7222aaf (diff) |
Initial interface rework to allow knowing whether to pull payload at registration, not at request time
Diffstat (limited to 'include')
-rw-r--r-- | include/grpc/grpc.h | 15 | ||||
-rw-r--r-- | include/grpc/impl/codegen/grpc_types.h | 4 |
2 files changed, 15 insertions, 4 deletions
diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 8b460722e2..5c868aece3 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -289,6 +289,14 @@ GRPCAPI grpc_call_error grpc_server_request_call( grpc_completion_queue *cq_bound_to_call, grpc_completion_queue *cq_for_notification, void *tag_new); +/** How to handle payloads for a registered method */ +typedef enum { + /** Don't try to read the payload */ + GRPC_SRM_PAYLOAD_NONE, + /** Read the initial payload as a byte buffer */ + GRPC_SRM_PAYLOAD_READ_INITIAL_BYTE_BUFFER +} grpc_server_register_method_payload_handling; + /** Registers a method in the server. Methods to this (host, method) pair will not be reported by grpc_server_request_call, but instead be reported by @@ -296,9 +304,10 @@ GRPCAPI grpc_call_error grpc_server_request_call( registered_method (as returned by this function). Must be called before grpc_server_start. Returns NULL on failure. */ -GRPCAPI void *grpc_server_register_method(grpc_server *server, - const char *method, const char *host, - uint32_t flags); +GRPCAPI void *grpc_server_register_method( + grpc_server *server, const char *method, const char *host, + grpc_server_register_method_payload_handling payload_handling, + uint32_t flags); /** Request notification of a new pre-registered call. 'cq_for_notification' must have been registered to the server via diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h index b09b1cdf44..38da99b4d7 100644 --- a/include/grpc/impl/codegen/grpc_types.h +++ b/include/grpc/impl/codegen/grpc_types.h @@ -185,7 +185,9 @@ typedef enum grpc_call_error { server */ GRPC_CALL_ERROR_NOT_SERVER_COMPLETION_QUEUE, /** this batch of operations leads to more operations than allowed */ - GRPC_CALL_ERROR_BATCH_TOO_BIG + GRPC_CALL_ERROR_BATCH_TOO_BIG, + /** payload type requested is not the type registered */ + GRPC_CALL_ERROR_PAYLOAD_TYPE_MISMATCH } grpc_call_error; /* Write Flags: */ |