diff options
author | Michael Lumish <mlumish@google.com> | 2015-07-30 16:14:19 -0700 |
---|---|---|
committer | Michael Lumish <mlumish@google.com> | 2015-07-30 16:14:19 -0700 |
commit | 9b0fd3b317d59de21a67ec11001d30d2ae7c2053 (patch) | |
tree | c14606befaf2fe1f802d3692a4c3091a079aa610 /include | |
parent | 772fb1e9772373f6fa8b815860da222b3e9c8b42 (diff) | |
parent | 1178900c04556a3d59d789d3ecd84ea6a20548fc (diff) |
Merge pull request #2723 from a-veitch/issue_2710
Move grpc_census_call_*_context calls into public header
Diffstat (limited to 'include')
-rw-r--r-- | include/grpc/grpc.h | 48 |
1 files changed, 31 insertions, 17 deletions
diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index cf59b943e9..b33d2cd68c 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -50,7 +50,7 @@ extern "C" { * \section intro_sec The GRPC Core library is a low-level library designed * to be wrapped by higher level libraries. * - * The top-level API is provided in grpc.h. + * The top-level API is provided in grpc.h. * Security related functionality lives in grpc_security.h. */ @@ -175,7 +175,7 @@ typedef enum grpc_call_error { GRPC_CALL_ERROR_INVALID_FLAGS, /** invalid metadata was passed to this call */ GRPC_CALL_ERROR_INVALID_METADATA, - /** completion queue for notification has not been registered with the + /** completion queue for notification has not been registered with the server */ GRPC_CALL_ERROR_NOT_SERVER_COMPLETION_QUEUE } grpc_call_error; @@ -198,7 +198,8 @@ typedef struct grpc_metadata { size_t value_length; /** The following fields are reserved for grpc internal use. - There is no need to initialize them, and they will be set to garbage during + There is no need to initialize them, and they will be set to garbage + during calls to grpc. */ struct { void *obfuscated[3]; @@ -256,24 +257,25 @@ typedef enum { /** Send a message: 0 or more of these operations can occur for each call */ GRPC_OP_SEND_MESSAGE, /** Send a close from the client: one and only one instance MUST be sent from - the client, unless the call was cancelled - in which case this can be + the client, unless the call was cancelled - in which case this can be skipped */ GRPC_OP_SEND_CLOSE_FROM_CLIENT, /** Send status from the server: one and only one instance MUST be sent from - the server unless the call was cancelled - in which case this can be + the server unless the call was cancelled - in which case this can be skipped */ GRPC_OP_SEND_STATUS_FROM_SERVER, - /** Receive initial metadata: one and only one MUST be made on the client, + /** Receive initial metadata: one and only one MUST be made on the client, must not be made on the server */ GRPC_OP_RECV_INITIAL_METADATA, - /** Receive a message: 0 or more of these operations can occur for each call */ + /** Receive a message: 0 or more of these operations can occur for each call + */ GRPC_OP_RECV_MESSAGE, /** Receive status on the client: one and only one must be made on the client. This operation always succeeds, meaning ops paired with this operation will also appear to succeed, even though they may not have. In that case the status will indicate some failure. */ GRPC_OP_RECV_STATUS_ON_CLIENT, - /** Receive close on the server: one and only one must be made on the + /** Receive close on the server: one and only one must be made on the server */ GRPC_OP_RECV_CLOSE_ON_SERVER } grpc_op_type; @@ -284,7 +286,7 @@ typedef struct grpc_op { /** Operation type, as defined by grpc_op_type */ grpc_op_type op; /** Write flags bitset for grpc_begin_messages */ - gpr_uint32 flags; + gpr_uint32 flags; union { struct { size_t count; @@ -303,21 +305,23 @@ typedef struct grpc_op { After the operation completes, call grpc_metadata_array_destroy on this value, or reuse it in a future op. */ grpc_metadata_array *recv_initial_metadata; - /** ownership of the byte buffer is moved to the caller; the caller must call + /** ownership of the byte buffer is moved to the caller; the caller must + call grpc_byte_buffer_destroy on this value, or reuse it in a future op. */ grpc_byte_buffer **recv_message; struct { /** ownership of the array is with the caller, but ownership of the - elements stays with the call object (ie key, value members are owned + elements stays with the call object (ie key, value members are owned by the call object, trailing_metadata->array is owned by the caller). - After the operation completes, call grpc_metadata_array_destroy on this + After the operation completes, call grpc_metadata_array_destroy on + this value, or reuse it in a future op. */ grpc_metadata_array *trailing_metadata; grpc_status_code *status; /** status_details is a buffer owned by the application before the op completes and after the op has completed. During the operation - status_details may be reallocated to a size larger than - *status_details_capacity, in which case *status_details_capacity will + status_details may be reallocated to a size larger than + *status_details_capacity, in which case *status_details_capacity will be updated with the new array capacity. Pre-allocating space: @@ -460,6 +464,16 @@ grpc_call_error grpc_call_start_batch(grpc_call *call, const grpc_op *ops, functionality. Instead, use grpc_auth_context. */ char *grpc_call_get_peer(grpc_call *call); +struct census_context; + +/* Set census context for a call; Must be called before first call to + grpc_call_start_batch(). */ +void grpc_census_call_set_context(grpc_call *call, + struct census_context *context); + +/* Retrieve the calls current census context. */ +struct census_context *grpc_census_call_get_context(grpc_call *call); + /** Return a newly allocated string representing the target a channel was created for. */ char *grpc_channel_get_target(grpc_channel *channel); @@ -506,7 +520,7 @@ grpc_call_error grpc_call_cancel_with_status(grpc_call *call, void grpc_call_destroy(grpc_call *call); /** Request notification of a new call. 'cq_for_notification' must - have been registered to the server via + have been registered to the server via grpc_server_register_completion_queue. */ grpc_call_error grpc_server_request_call( grpc_server *server, grpc_call **call, grpc_call_details *details, @@ -524,8 +538,8 @@ grpc_call_error grpc_server_request_call( void *grpc_server_register_method(grpc_server *server, const char *method, const char *host); -/** Request notification of a new pre-registered call. 'cq_for_notification' - must have been registered to the server via +/** Request notification of a new pre-registered call. 'cq_for_notification' + must have been registered to the server via grpc_server_register_completion_queue. */ grpc_call_error grpc_server_request_registered_call( grpc_server *server, void *registered_method, grpc_call **call, |