GRPC Core
18.0.0
|
Interface for load balancing policies. More...
#include <lb_policy.h>
Data Structures | |
struct | Args |
Args used to instantiate an LB policy. More... | |
struct | BackendMetricData |
class | CallState |
Interface for accessing per-call state. More... | |
class | ChannelControlHelper |
A proxy object implemented by the client channel and used by the LB policy to communicate with the channel. More... | |
class | Config |
Interface for configuration data used by an LB policy implementation. More... | |
class | MetadataInterface |
Interface for accessing metadata. More... | |
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 | SubchannelPicker |
A subchannel picker is the object used to pick the subchannel to use for a given call. More... | |
class | TransientFailurePicker |
struct | UpdateArgs |
Data passed to the UpdateLocked() method when new addresses and config are available. More... | |
Public Member Functions | |
LoadBalancingPolicy (Args args, intptr_t initial_refcount=1) | |
~LoadBalancingPolicy () override | |
LoadBalancingPolicy (const LoadBalancingPolicy &)=delete | |
LoadBalancingPolicy & | operator= (const LoadBalancingPolicy &)=delete |
virtual const char * | name () const =0 |
Returns the name of the LB policy. More... | |
virtual void | UpdateLocked (UpdateArgs)=0 |
Updates the policy with new data from the resolver. More... | |
virtual void | ExitIdleLocked () |
Tries to enter a READY connectivity state. More... | |
virtual void | ResetBackoffLocked ()=0 |
Resets connection backoff. More... | |
grpc_pollset_set * | interested_parties () const |
void | Orphan () override |
![]() | |
InternallyRefCounted (const InternallyRefCounted &)=delete | |
InternallyRefCounted & | operator= (const InternallyRefCounted &)=delete |
![]() | |
Orphanable (const Orphanable &)=delete | |
Orphanable & | operator= (const Orphanable &)=delete |
Protected Member Functions | |
std::shared_ptr< WorkSerializer > | work_serializer () const |
ChannelControlHelper * | channel_control_helper () const |
virtual void | ShutdownLocked ()=0 |
Shuts down the policy. More... | |
![]() | |
InternallyRefCounted (const char *trace=nullptr, intptr_t initial_refcount=1) | |
~InternallyRefCounted () override=default | |
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) |
![]() | |
Orphanable () | |
virtual | ~Orphanable () |
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().
|
explicit |
|
override |
|
delete |
|
inlineprotected |
|
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.
|
inline |
|
pure virtual |
Returns the name of the LB policy.
Implemented in grpc_core::ChildPolicyHandler.
|
delete |
|
overridevirtual |
Implements grpc_core::Orphanable.
|
pure virtual |
Resets connection backoff.
Implemented in grpc_core::ChildPolicyHandler.
|
protectedpure virtual |
Shuts down the policy.
|
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 |