18#ifndef __CWIST_GRPC_CHANNEL_H__
19#define __CWIST_GRPC_CHANNEL_H__
44#define CWIST_GRPC_STATUS_BIT(code) (1u << (code))
123 const char *method,
const void *request,
124 size_t request_len, uint64_t timeout_ms);
128 const char **message);
142 const void *request,
size_t request_len,
143 uint64_t timeout_ms, uint8_t **response,
144 size_t *response_len,
char **status_message);
enum cwist_grpc_status cwist_grpc_status_t
@ CWIST_GRPC_CHANNEL_IDLE
@ CWIST_GRPC_CHANNEL_SHUTDOWN
@ CWIST_GRPC_CHANNEL_CONNECTING
@ CWIST_GRPC_CHANNEL_READY
@ CWIST_GRPC_CHANNEL_TRANSIENT_FAILURE
cwist_grpc_channel * cwist_grpc_channel_connect(const char *target, const cwist_grpc_channel_options *options)
Create a channel for target and resolve its backend addresses.
void cwist_grpc_channel_call_cancel(cwist_grpc_channel_call *call)
Cancel the underlying attempt call, if it reached the transport.
int cwist_grpc_channel_call_recv(cwist_grpc_channel_call *call, cwist_grpc_message *out)
Receive the next response message of a channel call.
cwist_grpc_status_t cwist_grpc_channel_call_finish(cwist_grpc_channel_call *call, const char **message)
Finish a channel call and return its final gRPC status.
cwist_grpc_channel_call * cwist_grpc_channel_call_start(cwist_grpc_channel *channel, const char *method, const void *request, size_t request_len, uint64_t timeout_ms)
Start a unary RPC through the channel, running the gRFC A6 retry engine transparently across attempts...
void cwist_grpc_channel_close(cwist_grpc_channel *channel)
Close a channel and free all its resources.
int cwist_grpc_channel_apply_service_config_json(cwist_grpc_channel *channel, const char *json)
Apply a JSON service config (doc/service_config.md subset, gRFC A6).
uint32_t cwist_grpc_channel_call_attempts(const cwist_grpc_channel_call *call)
Number of policy attempts a channel call used (transparent retries excluded).
struct cwist_grpc_channel_call cwist_grpc_channel_call
struct cwist_grpc_channel cwist_grpc_channel
cwist_grpc_status_t cwist_grpc_channel_unary(cwist_grpc_channel *channel, const char *method, const void *request, size_t request_len, uint64_t timeout_ms, uint8_t **response, size_t *response_len, char **status_message)
Convenience blocking unary RPC: start, read one response, finish.
void cwist_grpc_channel_call_destroy(cwist_grpc_channel_call *call)
Destroy a channel call and release its resources.
cwist_grpc_channel_state cwist_grpc_channel_get_state(cwist_grpc_channel *channel)
Aggregate connectivity state across subchannels (load-balancing.md).
@ CWIST_GRPC_LB_ROUND_ROBIN
@ CWIST_GRPC_LB_PICK_FIRST
HTTP/2-based gRPC client (h2c cleartext, or TLS with ALPN "h2").
uint64_t connect_timeout_ms
const cwist_grpc_retry_throttle * retry_throttle
uint64_t per_rpc_buffer_limit
cwist_grpc_lb_policy lb_policy
const cwist_grpc_retry_policy * retry_policy
uint32_t retryable_status_mask
uint64_t initial_backoff_ms
double backoff_multiplier