19 #ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_H 20 #define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_H 114 virtual void*
Alloc(
size_t size) = 0;
126 :
public std::iterator<std::input_iterator_tag,
127 std::pair<StringView, StringView>,
129 std::pair<StringView, StringView>*,
130 std::pair<StringView, StringView>&
134 : md_(md), handle_(handle) {}
136 handle_ = md_->IteratorHandleNext(handle_);
140 return md_ == other.md_ && handle_ == other.handle_;
143 value_type
operator*()
const {
return md_->IteratorHandleGet(handle_); }
174 virtual intptr_t IteratorHandleNext(intptr_t handle)
const = 0;
176 IteratorHandleGet(intptr_t handle)
const = 0;
229 std::function<void(grpc_error*, MetadataInterface*, CallState*)>
272 std::unique_ptr<SubchannelPicker>) = 0;
290 virtual const char*
name()
const = 0;
338 virtual const char*
name()
const = 0;
364 : parent_(std::move(parent)) {}
371 static void CallExitIdle(
void* arg,
grpc_error* error);
374 bool exit_idle_called_ =
false;
395 return channel_control_helper_.get();
407 std::unique_ptr<ChannelControlHelper> channel_control_helper_;
Interface for configuration data used by an LB policy implementation.
Definition: lb_policy.h:285
virtual ~Config()=default
std::map< StringView, double, StringLess > utilization
Application-specific resource utilization metrics.
Definition: lb_policy.h:100
Data passed to the UpdateLocked() method when new addresses and config are available.
Definition: lb_policy.h:295
CallState * call_state
An interface for accessing call state.
Definition: lb_policy.h:188
Definition: string_view.h:69
RefCountedPtr< Config > config
Definition: lb_policy.h:297
UpdateArgs & operator=(const UpdateArgs &other)
Definition: lb_policy.cc:68
Definition: lb_policy.h:361
An array of arguments that can be passed around.
Definition: grpc_types.h:132
virtual const BackendMetricData * GetBackendMetricData()=0
Returns the backend metric data returned by the server for the call, or null if no backend metric dat...
The result of picking a subchannel for a call.
Definition: lb_policy.h:192
virtual void UpdateState(grpc_connectivity_state state, std::unique_ptr< SubchannelPicker >)=0
Sets the connectivity state and returns a new picker to be used by the client channel.
LoadBalancingPolicy(Args args, intptr_t initial_refcount=1)
Definition: lb_policy.cc:34
TraceSeverity
Adds a trace message associated with the channel.
Definition: lb_policy.h:278
ChannelControlHelper()=default
Interface for load balancing policies.
Definition: lb_policy.h:81
Definition: error_internal.h:39
grpc_connectivity_state
Connectivity state of a channel.
Definition: connectivity_state.h:27
virtual void * Alloc(size_t size)=0
Allocates memory associated with the call, which will be automatically freed when the call is complet...
std::unique_ptr< ChannelControlHelper > channel_control_helper
Channel control helper.
Definition: lb_policy.h:321
virtual void UpdateLocked(UpdateArgs)=0
Updates the policy with new data from the resolver.
#define DEBUG_LOCATION
Definition: debug_location.h:41
~TransientFailurePicker() override
Definition: lb_policy.h:381
const grpc_channel_args * args
Definition: lb_policy.h:298
virtual ~CallState()=default
Definition: orphanable.h:77
double cpu_utilization
CPU utilization expressed as a fraction of available CPU resources.
Definition: lb_policy.h:86
Round Robin Policy.
Definition: backend_metric.cc:24
Definition: lb_policy.h:278
void grpc_channel_args_destroy(grpc_channel_args *a)
Destroy arguments created by grpc_channel_args_copy.
Definition: channel_args.cc:197
const grpc_channel_args * args
Channel args.
Definition: lb_policy.h:327
A subchannel picker is the object used to pick the subchannel to use for a given call.
Definition: lb_policy.h:247
virtual void ExitIdleLocked()
Tries to enter a READY connectivity state.
Definition: lb_policy.h:348
virtual const char * name() const =0
Interface for accessing per-call state.
Definition: lb_policy.h:105
std::map< StringView, double, StringLess > request_cost
Application-specific requests cost metrics.
Definition: lb_policy.h:96
Definition: lb_policy.h:378
PickResult Pick(PickArgs args) override
Definition: lb_policy.cc:129
Definition: combiner.h:33
DebugOnlyTraceFlag grpc_trace_lb_policy_refcount(false, "lb_policy_refcount")
Definition: lb_policy.h:40
Definition: lb_policy.h:84
QueuePicker(RefCountedPtr< LoadBalancingPolicy > parent)
Definition: lb_policy.h:363
virtual void AddTraceEvent(TraceSeverity severity, StringView message)=0
virtual void ShutdownLocked()=0
Shuts down the policy.
virtual ~SubchannelPicker()=default
double mem_utilization
Memory utilization expressed as a fraction of available memory resources.
Definition: lb_policy.h:89
TransientFailurePicker(grpc_error *error)
Definition: lb_policy.h:380
ResultType type
Definition: lb_policy.h:209
Definition: ref_counted_ptr.h:35
uint64_t requests_per_second
Total requests per second being served by the backend.
Definition: lb_policy.h:92
virtual void ResetBackoffLocked()=0
Resets connection backoff.
grpc_pollset_set * interested_parties() const
Definition: lb_policy.h:353
std::function< void(grpc_error *, MetadataInterface *, CallState *)> recv_trailing_metadata_ready
Used only if type is PICK_COMPLETE.
Definition: lb_policy.h:230
PickResult Pick(PickArgs args) override
Definition: lb_policy.cc:92
Pick complete.
Definition: lb_policy.h:197
struct grpc_pollset_set grpc_pollset_set
Definition: pollset_set.h:31
Definition: lb_policy.h:278
virtual void RequestReresolution()=0
Requests that the resolver re-resolve.
Pick cannot be completed until something changes on the control plane.
Definition: lb_policy.h:201
Args used to instantiate an LB policy.
Definition: lb_policy.h:311
Combiner * combiner
The combiner under which all LB policy calls will be run.
Definition: lb_policy.h:317
Arguments used when picking a subchannel for a call.
Definition: lb_policy.h:180
A proxy object implemented by the client channel and used by the LB policy to communicate with the ch...
Definition: lb_policy.h:260
#define GRPC_ERROR_NONE
The following "special" errors can be propagated without allocating memory.
Definition: error.h:125
RefCountedPtr< SubchannelInterface > subchannel
Used only if type is PICK_COMPLETE.
Definition: lb_policy.h:213
Definition: ref_counted.h:248
ServerAddressList addresses
Definition: lb_policy.h:296
virtual RefCountedPtr< SubchannelInterface > CreateSubchannel(const grpc_channel_args &args)=0
Creates a new subchannel with the specified channel args.
virtual ~ChannelControlHelper()=default
virtual ~LoadBalancingPolicy()
Definition: lb_policy.cc:40
virtual PickResult Pick(PickArgs args)=0
#define GRPC_ERROR_UNREF(err)
Definition: error.h:186
virtual const char * name() const =0
Returns the name of the LB policy.
void Orphan() override
Definition: lb_policy.cc:45
~QueuePicker()
Definition: lb_policy.h:366
Combiner * combiner() const
Definition: lb_policy.h:390
MetadataInterface * initial_metadata
Initial metadata associated with the picking call.
Definition: lb_policy.h:185
Pick failed.
Definition: lb_policy.h:207
Definition: lb_policy.h:278
grpc_error * error
Used only if type is PICK_FAILED.
Definition: lb_policy.h:219
ChannelControlHelper * channel_control_helper() const
Definition: lb_policy.h:394
SubchannelPicker()=default
LoadBalancingPolicy & operator=(const LoadBalancingPolicy &)=delete
~UpdateArgs()
Definition: lb_policy.h:303
ResultType
Definition: lb_policy.h:193