GRPC Core  18.0.0
Namespaces | Macros | Functions
channel.cc File Reference
#include <grpc/support/port_platform.h>
#include "src/core/lib/surface/channel.h"
#include <inttypes.h>
#include <limits.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 "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/channel_trace.h"
#include "src/core/lib/channel/channelz.h"
#include "src/core/lib/channel/channelz_registry.h"
#include "src/core/lib/debug/stats.h"
#include "src/core/lib/gprpp/manual_constructor.h"
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/iomgr/iomgr.h"
#include "src/core/lib/iomgr/resource_quota.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/surface/call.h"
#include "src/core/lib/surface/channel_init.h"
#include "src/core/lib/transport/static_metadata.h"

Namespaces

 grpc_core
 Round Robin Policy.
 

Macros

#define NUM_CACHED_STATUS_ELEMS   3
 Cache grpc-status: X mdelems for X = 0..NUM_CACHED_STATUS_ELEMS. More...
 
#define ROUND_UP_SIZE   256
 

Functions

grpc_channelgrpc_channel_create_with_builder (grpc_channel_stack_builder *builder, grpc_channel_stack_type channel_stack_type, grpc_error_handle *error)
 
grpc_channelgrpc_channel_create (const char *target, const grpc_channel_args *input_args, grpc_channel_stack_type channel_stack_type, grpc_transport *optional_transport, grpc_resource_user *resource_user, grpc_error_handle *error)
 
size_t grpc_channel_get_call_size_estimate (grpc_channel *channel)
 
void grpc_channel_update_call_size_estimate (grpc_channel *channel, size_t size)
 
char * grpc_channel_get_target (grpc_channel *channel)
 Return a newly allocated string representing the target a channel was created for. More...
 
void grpc_channel_get_info (grpc_channel *channel, const grpc_channel_info *channel_info)
 Request info about the channel. More...
 
void grpc_channel_reset_connect_backoff (grpc_channel *channel)
 EXPERIMENTAL. More...
 
grpc_callgrpc_channel_create_call (grpc_channel *channel, grpc_call *parent_call, uint32_t propagation_mask, grpc_completion_queue *completion_queue, grpc_slice method, const grpc_slice *host, gpr_timespec deadline, void *reserved)
 Create a call given a grpc_channel, in order to call 'method'. More...
 
grpc_callgrpc_channel_create_pollset_set_call (grpc_channel *channel, grpc_call *parent_call, uint32_t propagation_mask, grpc_pollset_set *pollset_set, const grpc_slice &method, const grpc_slice *host, grpc_millis deadline, void *reserved)
 Create a call given a grpc_channel, in order to call method. More...
 
void * grpc_channel_register_call (grpc_channel *channel, const char *method, const char *host, void *reserved)
 Pre-register a method/host pair on a channel. More...
 
grpc_callgrpc_channel_create_registered_call (grpc_channel *channel, grpc_call *parent_call, uint32_t propagation_mask, grpc_completion_queue *completion_queue, void *registered_call_handle, gpr_timespec deadline, void *reserved)
 Create a call given a handle returned from grpc_channel_register_call. More...
 
void grpc_channel_destroy_internal (grpc_channel *channel)
 The same as grpc_channel_destroy, but doesn't create an ExecCtx, and so is safe to use from within core. More...
 
void grpc_channel_destroy (grpc_channel *channel)
 Close and destroy a grpc channel. More...
 

Macro Definition Documentation

◆ NUM_CACHED_STATUS_ELEMS

#define NUM_CACHED_STATUS_ELEMS   3

Cache grpc-status: X mdelems for X = 0..NUM_CACHED_STATUS_ELEMS.

Avoids needing to take a metadata context lock for sending status if the status code is <= NUM_CACHED_STATUS_ELEMS. Sized to allow the most commonly used codes to fit in (OK, Cancelled, Unknown).

◆ ROUND_UP_SIZE

#define ROUND_UP_SIZE   256

Function Documentation

◆ grpc_channel_create()

grpc_channel* grpc_channel_create ( const char *  target,
const grpc_channel_args input_args,
grpc_channel_stack_type  channel_stack_type,
grpc_transport optional_transport,
grpc_resource_user resource_user,
grpc_error_handle error 
)

◆ grpc_channel_create_call()

grpc_call* grpc_channel_create_call ( grpc_channel channel,
grpc_call parent_call,
uint32_t  propagation_mask,
grpc_completion_queue completion_queue,
grpc_slice  method,
const grpc_slice host,
gpr_timespec  deadline,
void *  reserved 
)

Create a call given a grpc_channel, in order to call 'method'.

All completions are sent to 'completion_queue'. 'method' and 'host' need only live through the invocation of this function. If parent_call is non-NULL, it must be a server-side call. It will be used to propagate properties from the server call to this new client call, depending on the value of propagation_mask (see propagation_bits.h for possible values).

◆ grpc_channel_create_pollset_set_call()

grpc_call* grpc_channel_create_pollset_set_call ( grpc_channel channel,
grpc_call parent_call,
uint32_t  propagation_mask,
grpc_pollset_set pollset_set,
const grpc_slice method,
const grpc_slice host,
grpc_millis  deadline,
void *  reserved 
)

Create a call given a grpc_channel, in order to call method.

Progress is tied to activity on pollset_set. The returned call object is meant to be used with grpc_call_start_batch_and_execute, which relies on callbacks to signal completions. method and host need only live through the invocation of this function. If parent_call is non-NULL, it must be a server-side call. It will be used to propagate properties from the server call to this new client call, depending on the value of propagation_mask (see propagation_bits.h for possible values)

◆ grpc_channel_create_registered_call()

grpc_call* grpc_channel_create_registered_call ( grpc_channel channel,
grpc_call parent_call,
uint32_t  propagation_mask,
grpc_completion_queue completion_queue,
void *  registered_call_handle,
gpr_timespec  deadline,
void *  reserved 
)

Create a call given a handle returned from grpc_channel_register_call.

See also
grpc_channel_create_call.

◆ grpc_channel_create_with_builder()

grpc_channel* grpc_channel_create_with_builder ( grpc_channel_stack_builder builder,
grpc_channel_stack_type  channel_stack_type,
grpc_error_handle error 
)

◆ grpc_channel_destroy()

void grpc_channel_destroy ( grpc_channel channel)

Close and destroy a grpc channel.

◆ grpc_channel_destroy_internal()

void grpc_channel_destroy_internal ( grpc_channel channel)

The same as grpc_channel_destroy, but doesn't create an ExecCtx, and so is safe to use from within core.

◆ grpc_channel_get_call_size_estimate()

size_t grpc_channel_get_call_size_estimate ( grpc_channel channel)

◆ grpc_channel_get_info()

void grpc_channel_get_info ( grpc_channel channel,
const grpc_channel_info channel_info 
)

Request info about the channel.

channel_info indicates what information is being requested and how that information will be returned. channel_info is owned by the caller.

◆ grpc_channel_get_target()

char* grpc_channel_get_target ( grpc_channel channel)

Return a newly allocated string representing the target a channel was created for.

◆ grpc_channel_register_call()

void* grpc_channel_register_call ( grpc_channel channel,
const char *  method,
const char *  host,
void *  reserved 
)

Pre-register a method/host pair on a channel.

method and host are not owned and must remain alive while the channel is alive.

◆ grpc_channel_reset_connect_backoff()

void grpc_channel_reset_connect_backoff ( grpc_channel channel)

EXPERIMENTAL.

Resets the channel's connect backoff. TODO(roth): When we see whether this proves useful, either promote to non-experimental or remove it.

◆ grpc_channel_update_call_size_estimate()

void grpc_channel_update_call_size_estimate ( grpc_channel channel,
size_t  size 
)