Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(targetAddr string, parent http.RoundTripper, resolver naming.Resolver, policy LBPolicy) (*tripper, error)
New creates a new load-balanced Round Tripper for a single backend.
This RoundTripper is meant to only dial a single backend, and will throw errors if the req.URL.Host doesn't match the targetAddr.
For resolving backend addresses it uses a grpc.naming.Resolver, allowing for generic use.
Types ¶
type LBPolicy ¶
type LBPolicy interface { // Picker returns PolicyPicker that is suitable to be used within single request. Picker() LBPolicyPicker }
func RoundRobinPolicy ¶
func RoundRobinPolicyFromFlags ¶
func RoundRobinPolicyFromFlags() LBPolicy
type LBPolicyPicker ¶
type LBPolicyPicker interface { // Pick decides on which target to use for the request out of the provided ones. Pick(req *http.Request, currentTargets []*Target) (*Target, error) // ExcludeHost excludes the given target for a short time. It is useful to report no connection (even temporary). ExcludeTarget(*Target) }
LBPolicyPicker decides which target to pick for a given call. Should be short-living.
Click to show internal directories.
Click to hide internal directories.