#include <lb_policy.h>
Classes | |
struct | Args |
Args used to instantiate an LB policy. More... | |
class | BackendMetricAccessor |
class | CallState |
class | ChannelControlHelper |
class | Config |
class | MetadataInterface |
struct | PickArgs |
Arguments used when picking a subchannel for a call. More... | |
struct | PickResult |
The result of picking a subchannel for a call. More... | |
class | QueuePicker |
class | SubchannelCallTrackerInterface |
class | SubchannelPicker |
class | TransientFailurePicker |
struct | UpdateArgs |
Public Member Functions | |
virtual void | ExitIdleLocked () |
grpc_pollset_set * | interested_parties () const |
LoadBalancingPolicy (Args args, intptr_t initial_refcount=1) | |
LoadBalancingPolicy (const LoadBalancingPolicy &)=delete | |
virtual const char * | name () const =0 |
Returns the name of the LB policy. More... | |
LoadBalancingPolicy & | operator= (const LoadBalancingPolicy &)=delete |
void | Orphan () override |
virtual void | ResetBackoffLocked ()=0 |
Resets connection backoff. More... | |
virtual void | UpdateLocked (UpdateArgs)=0 |
~LoadBalancingPolicy () override | |
![]() | |
InternallyRefCounted (const InternallyRefCounted &)=delete | |
InternallyRefCounted & | operator= (const InternallyRefCounted &)=delete |
![]() | |
Orphanable & | operator= (const Orphanable &)=delete |
Orphanable (const Orphanable &)=delete | |
Protected Member Functions | |
ChannelControlHelper * | channel_control_helper () const |
virtual void | ShutdownLocked ()=0 |
Shuts down the policy. More... | |
std::shared_ptr< WorkSerializer > | work_serializer () const |
![]() | |
InternallyRefCounted (const char *trace=nullptr, intptr_t initial_refcount=1) | |
RefCountedPtr< LoadBalancingPolicy > | Ref () GRPC_MUST_USE_RESULT |
RefCountedPtr< LoadBalancingPolicy > | Ref (const DebugLocation &location, const char *reason) GRPC_MUST_USE_RESULT |
void | Unref () |
void | Unref (const DebugLocation &location, const char *reason) |
~InternallyRefCounted () override=default | |
![]() | |
Orphanable () | |
virtual | ~Orphanable () |
Private Attributes | |
std::unique_ptr< ChannelControlHelper > | channel_control_helper_ |
Channel control helper. More... | |
grpc_pollset_set * | interested_parties_ |
Owned pointer to interested parties in load balancing decisions. More... | |
std::shared_ptr< WorkSerializer > | work_serializer_ |
Work Serializer under which LB policy actions take place. More... | |
Interface for load balancing policies.
The following concepts are used here:
Channel: An abstraction that manages connections to backend servers on behalf of a client application. The application creates a channel for a given server name and then sends calls (RPCs) on it, and the channel figures out which backend server to send each call to. A channel contains a resolver, a load balancing policy (or a tree of LB policies), and a set of one or more subchannels.
Subchannel: A subchannel represents a connection to one backend server. The LB policy decides which subchannels to create, manages the connectivity state of those subchannels, and decides which subchannel to send any given call to.
Resolver: A plugin that takes a gRPC server URI and resolves it to a list of one or more addresses and a service config, as described in https://github.com/grpc/grpc/blob/master/doc/naming.md. See resolver.h for the resolver API.
Load Balancing (LB) Policy: A plugin that takes a list of addresses from the resolver, maintains and manages a subchannel for each backend address, and decides which subchannel to send each call on. An LB policy has two parts:
Note: All methods with a "Locked" suffix must be called from the work_serializer passed to the constructor.
Any I/O done by the LB policy should be done under the pollset_set returned by interested_parties().
Definition at line 95 of file lb_policy.h.
|
explicit |
Definition at line 36 of file lb_policy.cc.
|
override |
Definition at line 46 of file lb_policy.cc.
|
delete |
|
inlineprotected |
Definition at line 426 of file lb_policy.h.
|
inlinevirtual |
Tries to enter a READY connectivity state. This is a no-op by default, since most LB policies never go into IDLE state.
Reimplemented in grpc_core::ChildPolicyHandler.
Definition at line 379 of file lb_policy.h.
|
inline |
Definition at line 384 of file lb_policy.h.
|
pure virtual |
Returns the name of the LB policy.
Implemented in grpc_core::ChildPolicyHandler.
|
delete |
|
overridevirtual |
Implements grpc_core::Orphanable.
Definition at line 50 of file lb_policy.cc.
|
pure virtual |
Resets connection backoff.
Implemented in grpc_core::ChildPolicyHandler.
|
protectedpure virtual |
Shuts down the policy.
Implemented in grpc_core::ChildPolicyHandler.
|
pure virtual |
Updates the policy with new data from the resolver. Will be invoked immediately after LB policy is constructed, and then again whenever the resolver returns a new result.
Implemented in grpc_core::ChildPolicyHandler.
|
inlineprotected |
Definition at line 420 of file lb_policy.h.
|
private |
Channel control helper.
Definition at line 439 of file lb_policy.h.
|
private |
Owned pointer to interested parties in load balancing decisions.
Definition at line 437 of file lb_policy.h.
|
private |
Work Serializer under which LB policy actions take place.
Definition at line 435 of file lb_policy.h.