Classes | Namespaces | Functions | Variables
call.cc File Reference
#include <grpc/support/port_platform.h>
#include "src/core/lib/surface/call.h"
#include <limits.h>
#include <stdlib.h>
#include <algorithm>
#include <atomic>
#include <new>
#include <string>
#include <utility>
#include "absl/base/thread_annotations.h"
#include "absl/meta/type_traits.h"
#include "absl/status/status.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h"
#include "absl/strings/string_view.h"
#include <grpc/byte_buffer.h>
#include <grpc/compression.h>
#include <grpc/grpc.h>
#include <grpc/impl/codegen/gpr_types.h>
#include <grpc/impl/codegen/propagation_bits.h>
#include <grpc/slice.h>
#include <grpc/slice_buffer.h>
#include <grpc/status.h>
#include <grpc/support/alloc.h>
#include <grpc/support/atm.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include "src/core/lib/channel/channel_stack.h"
#include "src/core/lib/channel/channelz.h"
#include "src/core/lib/channel/context.h"
#include "src/core/lib/compression/compression_internal.h"
#include "src/core/lib/debug/stats.h"
#include "src/core/lib/gpr/alloc.h"
#include "src/core/lib/gpr/time_precise.h"
#include "src/core/lib/gprpp/cpp_impl_of.h"
#include "src/core/lib/gprpp/debug_location.h"
#include "src/core/lib/gprpp/ref_counted.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/iomgr/call_combiner.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/iomgr/polling_entity.h"
#include "src/core/lib/profiling/timers.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/slice/slice_buffer.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/slice/slice_refcount.h"
#include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/surface/call_test_only.h"
#include "src/core/lib/surface/channel.h"
#include "src/core/lib/surface/completion_queue.h"
#include "src/core/lib/surface/server.h"
#include "src/core/lib/surface/validate_metadata.h"
#include "src/core/lib/transport/error_utils.h"
#include "src/core/lib/transport/metadata_batch.h"
#include "src/core/lib/transport/transport.h"

Go to the source code of this file.

Classes

struct  grpc_core::FilterStackCall::BatchControl
 
class  grpc_core::Call
 
struct  grpc_core::Call::ChildCall
 
class  grpc_core::FilterStackCall
 
struct  grpc_core::Call::ParentCall
 

Namespaces

 grpc_core
 

Functions

static void grpc_core::done_termination (void *arg, grpc_error_handle)
 
void * grpc_call_arena_alloc (grpc_call *call, size_t size)
 
grpc_call_error grpc_call_cancel (grpc_call *call, void *reserved)
 
void grpc_call_cancel_internal (grpc_call *call)
 
grpc_call_error grpc_call_cancel_with_status (grpc_call *c, grpc_status_code status, const char *description, void *reserved)
 
grpc_compression_algorithm grpc_call_compression_for_level (grpc_call *call, grpc_compression_level level)
 
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(*destroy)(void *value))
 
grpc_error_handle grpc_call_create (grpc_call_create_args *args, grpc_call **out_call)
 
const char * grpc_call_error_to_string (grpc_call_error error)
 
int grpc_call_failed_before_recv_message (const grpc_call *c)
 
grpc_callgrpc_call_from_top_element (grpc_call_element *surface_element)
 
grpc_core::Arenagrpc_call_get_arena (grpc_call *call)
 
grpc_call_stackgrpc_call_get_call_stack (grpc_call *call)
 
size_t grpc_call_get_initial_size_estimate ()
 
char * grpc_call_get_peer (grpc_call *call)
 
uint8_t grpc_call_is_client (grpc_call *call)
 
bool grpc_call_is_trailers_only (const grpc_call *call)
 
void grpc_call_ref (grpc_call *c)
 
absl::string_view grpc_call_server_authority (const grpc_call *call)
 
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)
 
grpc_call_error grpc_call_start_batch_and_execute (grpc_call *call, const grpc_op *ops, size_t nops, grpc_closure *closure)
 
grpc_compression_algorithm grpc_call_test_only_get_compression_algorithm (grpc_call *call)
 
uint32_t grpc_call_test_only_get_encodings_accepted_by_peer (grpc_call *call)
 
uint32_t grpc_call_test_only_get_message_flags (grpc_call *call)
 
void grpc_call_unref (grpc_call *c)
 

Variables

grpc_core::TraceFlag grpc_call_error_trace (false, "call_error")
 
grpc_core::TraceFlag grpc_compression_trace (false, "compression")
 

Function Documentation

◆ grpc_call_arena_alloc()

void* grpc_call_arena_alloc ( grpc_call call,
size_t  size 
)

Allocate memory in the grpc_call arena: this memory is automatically discarded at call completion

Definition at line 1749 of file call.cc.

◆ grpc_call_cancel()

grpc_call_error grpc_call_cancel ( grpc_call call,
void *  reserved 
)

Error handling for grpc_call Most grpc_call functions return a grpc_error. If the error is not GRPC_OK then the operation failed due to some unsatisfied precondition. If a grpc_call fails, it's guaranteed that no change to the call state has been made. Cancel an RPC. 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_unref is called.

Definition at line 1782 of file call.cc.

◆ grpc_call_cancel_internal()

void grpc_call_cancel_internal ( grpc_call call)

Definition at line 1806 of file call.cc.

◆ grpc_call_cancel_with_status()

grpc_call_error grpc_call_cancel_with_status ( grpc_call call,
grpc_status_code  status,
const char *  description,
void *  reserved 
)

Cancel an RPC. 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. Note that description doesn't need be a static string. It doesn't need to be alive after the call to grpc_call_cancel_with_status completes.

Definition at line 1791 of file call.cc.

◆ grpc_call_compression_for_level()

grpc_compression_algorithm grpc_call_compression_for_level ( grpc_call call,
grpc_compression_level  level 
)

Definition at line 1867 of file call.cc.

◆ grpc_call_context_get()

void* grpc_call_context_get ( grpc_call call,
grpc_context_index  elem 
)

Definition at line 1859 of file call.cc.

◆ grpc_call_context_set()

void grpc_call_context_set ( grpc_call call,
grpc_context_index  elem,
void *  value,
void(*)(void *value destroy 
)

Definition at line 1854 of file call.cc.

◆ grpc_call_create()

grpc_error_handle grpc_call_create ( grpc_call_create_args args,
grpc_call **  out_call 
)

Definition at line 1758 of file call.cc.

◆ grpc_call_error_to_string()

const char* grpc_call_error_to_string ( grpc_call_error  error)

Convert grpc_call_error values to a string

Definition at line 1884 of file call.cc.

◆ grpc_call_failed_before_recv_message()

int grpc_call_failed_before_recv_message ( const grpc_call c)

Definition at line 1876 of file call.cc.

◆ grpc_call_from_top_element()

grpc_call* grpc_call_from_top_element ( grpc_call_element surface_element)

Definition at line 1778 of file call.cc.

◆ grpc_call_get_arena()

grpc_core::Arena* grpc_call_get_arena ( grpc_call call)

Definition at line 1823 of file call.cc.

◆ grpc_call_get_call_stack()

grpc_call_stack* grpc_call_get_call_stack ( grpc_call call)

Definition at line 1827 of file call.cc.

◆ grpc_call_get_initial_size_estimate()

size_t grpc_call_get_initial_size_estimate ( )

Definition at line 1754 of file call.cc.

◆ grpc_call_get_peer()

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.

Definition at line 1774 of file call.cc.

◆ grpc_call_is_client()

uint8_t grpc_call_is_client ( grpc_call call)

Definition at line 1863 of file call.cc.

◆ grpc_call_is_trailers_only()

bool grpc_call_is_trailers_only ( const grpc_call call)

Definition at line 1872 of file call.cc.

◆ grpc_call_ref()

void grpc_call_ref ( grpc_call call)

Ref a call. THREAD SAFETY: grpc_call_ref is thread-compatible

Definition at line 1768 of file call.cc.

◆ grpc_call_server_authority()

absl::string_view grpc_call_server_authority ( const grpc_call call)

Definition at line 1880 of file call.cc.

◆ grpc_call_set_completion_queue()

void grpc_call_set_completion_queue ( grpc_call call,
grpc_completion_queue cq 
)

Definition at line 1763 of file call.cc.

◆ grpc_call_start_batch()

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. If a call to grpc_call_start_batch returns GRPC_CALL_OK you must call grpc_completion_queue_next or grpc_completion_queue_pluck on the completion queue associated with 'call' for work to be performed. If a call to grpc_call_start_batch returns any value other than GRPC_CALL_OK it is guaranteed that no state associated with 'call' is changed and it is not appropriate to call grpc_completion_queue_next or grpc_completion_queue_pluck consequent to the failed grpc_call_start_batch call. If a call to grpc_call_start_batch with an empty batch returns GRPC_CALL_OK, the tag is put in the completion queue immediately. 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. Access to grpc_call_start_batch with an empty batch is thread-compatible.

Definition at line 1831 of file call.cc.

◆ grpc_call_start_batch_and_execute()

grpc_call_error grpc_call_start_batch_and_execute ( grpc_call call,
const grpc_op ops,
size_t  nops,
grpc_closure closure 
)

Definition at line 1847 of file call.cc.

◆ grpc_call_test_only_get_compression_algorithm()

grpc_compression_algorithm grpc_call_test_only_get_compression_algorithm ( grpc_call call)

Return the message compression algorithm from call.

Warning
This function should only be used in test code.

Definition at line 1810 of file call.cc.

◆ grpc_call_test_only_get_encodings_accepted_by_peer()

uint32_t grpc_call_test_only_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.

Definition at line 1819 of file call.cc.

◆ grpc_call_test_only_get_message_flags()

uint32_t grpc_call_test_only_get_message_flags ( grpc_call call)

Return the message flags from call.

Warning
This function should only be used in test code.

Definition at line 1815 of file call.cc.

◆ grpc_call_unref()

void grpc_call_unref ( grpc_call call)

Unref a call. THREAD SAFETY: grpc_call_unref is thread-compatible

Definition at line 1770 of file call.cc.

Variable Documentation

◆ call

FilterStackCall* call

Definition at line 750 of file call.cc.

◆ dest_

grpc_metadata_array* const dest_
private

Definition at line 922 of file call.cc.

◆ finish_batch

grpc_closure finish_batch

Definition at line 752 of file call.cc.

◆ grpc_call_error_trace

grpc_core::TraceFlag grpc_call_error_trace(false, "call_error")

◆ grpc_compression_trace

grpc_core::TraceFlag grpc_compression_trace(false, "compression")

◆ start_batch

grpc_closure start_batch

Definition at line 751 of file call.cc.



grpc
Author(s):
autogenerated on Fri May 16 2025 03:01:05