GRPC Core
0.11.0.0
|
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <grpc/compression.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
#include "src/core/channel/channel_stack.h"
#include "src/core/iomgr/alarm.h"
#include "src/core/profiling/timers.h"
#include "src/core/surface/byte_buffer_queue.h"
#include "src/core/surface/call.h"
#include "src/core/surface/channel.h"
#include "src/core/surface/completion_queue.h"
Data Structures | |
struct | completed_request |
struct | reqinfo_master |
struct | received_status |
struct | grpc_call |
struct | finished_loose_op_allocated_args |
Macros | |
#define | MAX_CONCURRENT_COMPLETIONS 6 |
The maximum number of completions possible. More... | |
#define | REQSET_EMPTY 'X' |
#define | REQSET_DONE 'Y' |
#define | MAX_SEND_INITIAL_METADATA_COUNT 3 |
#define | CALL_STACK_FROM_CALL(call) ((grpc_call_stack *)((call) + 1)) |
#define | CALL_FROM_CALL_STACK(call_stack) (((grpc_call *)(call_stack)) - 1) |
#define | CALL_ELEM_FROM_CALL(call, idx) grpc_call_stack_element(CALL_STACK_FROM_CALL(call), idx) |
#define | CALL_FROM_TOP_ELEM(top_elem) CALL_FROM_CALL_STACK(grpc_call_stack_from_top_element(top_elem)) |
#define | STATUS_OFFSET 1 |
#define | COMPRESS_OFFSET 1 |
Functions | |
grpc_call * | grpc_call_create (grpc_channel *channel, grpc_call *parent_call, gpr_uint32 propagation_mask, grpc_completion_queue *cq, const void *server_transport_data, grpc_mdelem **add_initial_metadata, size_t add_initial_metadata_count, gpr_timespec send_deadline) |
void | grpc_call_set_completion_queue (grpc_call *call, grpc_completion_queue *cq) |
grpc_completion_queue * | grpc_call_get_completion_queue (grpc_call *call) |
void | grpc_call_internal_ref (grpc_call *c) |
void | grpc_call_internal_unref (grpc_call *c, int allow_immediate_deletion) |
grpc_compression_algorithm | grpc_call_get_compression_algorithm (const grpc_call *call) |
gpr_uint32 | grpc_call_get_encodings_accepted_by_peer (grpc_call *call) |
Returns a bitset for the encodings (compression algorithms) supported by call's peer. More... | |
gpr_uint32 | grpc_call_get_message_flags (const grpc_call *call) |
grpc_call_error | grpc_call_start_ioreq_and_call_back (grpc_call *call, const grpc_ioreq *reqs, size_t nreqs, grpc_ioreq_completion_func on_complete, void *user_data) |
void | grpc_call_destroy (grpc_call *c) |
Destroy a call. More... | |
grpc_call_error | grpc_call_cancel (grpc_call *call, void *reserved) |
Called by clients to cancel an RPC on the server. More... | |
grpc_call_error | grpc_call_cancel_with_status (grpc_call *c, grpc_status_code status, const char *description, void *reserved) |
Called by clients to cancel an RPC on the server. More... | |
char * | grpc_call_get_peer (grpc_call *call) |
Returns a newly allocated string representing the endpoint to which this call is communicating with. More... | |
grpc_call * | grpc_call_from_top_element (grpc_call_element *elem) |
grpc_call_stack * | grpc_call_get_call_stack (grpc_call *call) |
grpc_call_error | grpc_call_start_batch (grpc_call *call, const grpc_op *ops, size_t nops, void *tag, void *reserved) |
Start a batch of operations defined in the array ops; when complete, post a completion of type 'tag' to the completion queue bound to the call. More... | |
void | grpc_call_context_set (grpc_call *call, grpc_context_index elem, void *value, void(*destroy)(void *value)) |
void * | grpc_call_context_get (grpc_call *call, grpc_context_index elem) |
gpr_uint8 | grpc_call_is_client (grpc_call *call) |
#define CALL_ELEM_FROM_CALL | ( | call, | |
idx | |||
) | grpc_call_stack_element(CALL_STACK_FROM_CALL(call), idx) |
#define CALL_FROM_CALL_STACK | ( | call_stack | ) | (((grpc_call *)(call_stack)) - 1) |
#define CALL_FROM_TOP_ELEM | ( | top_elem | ) | CALL_FROM_CALL_STACK(grpc_call_stack_from_top_element(top_elem)) |
#define CALL_STACK_FROM_CALL | ( | call | ) | ((grpc_call_stack *)((call) + 1)) |
#define COMPRESS_OFFSET 1 |
#define MAX_CONCURRENT_COMPLETIONS 6 |
The maximum number of completions possible.
Based upon the maximum number of individually queueable ops in the batch api:
#define MAX_SEND_INITIAL_METADATA_COUNT 3 |
#define REQSET_DONE 'Y' |
#define REQSET_EMPTY 'X' |
#define STATUS_OFFSET 1 |
enum read_state |
enum req_state |
enum send_action |
enum status_source |
enum write_state |
grpc_call_error grpc_call_cancel | ( | grpc_call * | call, |
void * | reserved | ||
) |
Called by clients to cancel an RPC on the server.
Can be called multiple times, from any thread. THREAD-SAFETY grpc_call_cancel and grpc_call_cancel_with_status are thread-safe, and can be called at any point before grpc_call_destroy is called.
grpc_call_error grpc_call_cancel_with_status | ( | grpc_call * | call, |
grpc_status_code | status, | ||
const char * | description, | ||
void * | reserved | ||
) |
Called by clients to cancel an RPC on the server.
Can be called multiple times, from any thread. If a status has not been received for the call, set it to the status code and description passed in. Importantly, this function does not send status nor description to the remote endpoint.
void* grpc_call_context_get | ( | grpc_call * | call, |
grpc_context_index | elem | ||
) |
void grpc_call_context_set | ( | grpc_call * | call, |
grpc_context_index | elem, | ||
void * | value, | ||
void(*)(void *value) | destroy | ||
) |
grpc_call* grpc_call_create | ( | grpc_channel * | channel, |
grpc_call * | parent_call, | ||
gpr_uint32 | propagation_mask, | ||
grpc_completion_queue * | cq, | ||
const void * | server_transport_data, | ||
grpc_mdelem ** | add_initial_metadata, | ||
size_t | add_initial_metadata_count, | ||
gpr_timespec | send_deadline | ||
) |
void grpc_call_destroy | ( | grpc_call * | call | ) |
Destroy a call.
THREAD SAFETY: grpc_call_destroy is thread-compatible
grpc_call* grpc_call_from_top_element | ( | grpc_call_element * | elem | ) |
grpc_call_stack* grpc_call_get_call_stack | ( | grpc_call * | call | ) |
grpc_completion_queue* grpc_call_get_completion_queue | ( | grpc_call * | call | ) |
grpc_compression_algorithm grpc_call_get_compression_algorithm | ( | const grpc_call * | call | ) |
gpr_uint32 grpc_call_get_encodings_accepted_by_peer | ( | grpc_call * | call | ) |
Returns a bitset for the encodings (compression algorithms) supported by call's peer.
To be indexed by grpc_compression_algorithm enum values.
gpr_uint32 grpc_call_get_message_flags | ( | const grpc_call * | call | ) |
char* grpc_call_get_peer | ( | grpc_call * | call | ) |
Returns a newly allocated string representing the endpoint to which this call is communicating with.
The string is in the uri format accepted by grpc_channel_create. The returned string should be disposed of with gpr_free().
WARNING: this value is never authenticated or subject to any security related code. It must not be used for any authentication related functionality. Instead, use grpc_auth_context.
void grpc_call_internal_ref | ( | grpc_call * | c | ) |
void grpc_call_internal_unref | ( | grpc_call * | c, |
int | allow_immediate_deletion | ||
) |
void grpc_call_set_completion_queue | ( | grpc_call * | call, |
grpc_completion_queue * | cq | ||
) |
grpc_call_error grpc_call_start_batch | ( | grpc_call * | call, |
const grpc_op * | ops, | ||
size_t | nops, | ||
void * | tag, | ||
void * | reserved | ||
) |
Start a batch of operations defined in the array ops; when complete, post a completion of type 'tag' to the completion queue bound to the call.
The order of ops specified in the batch has no significance. Only one operation of each type can be active at once in any given batch. You must call grpc_completion_queue_next or grpc_completion_queue_pluck on the completion queue associated with 'call' for work to be performed. THREAD SAFETY: access to grpc_call_start_batch in multi-threaded environment needs to be synchronized. As an optimization, you may synchronize batches containing just send operations independently from batches containing just receive operations.
grpc_call_error grpc_call_start_ioreq_and_call_back | ( | grpc_call * | call, |
const grpc_ioreq * | reqs, | ||
size_t | nreqs, | ||
grpc_ioreq_completion_func | on_complete, | ||
void * | user_data | ||
) |