Documentation
¶
Index ¶
Constants ¶
View Source
const ( ConsistentHash = "consistent_hash" DefaultConsistentHashKey = "consistent-hash" )
View Source
const ( DefaultReplicas = 10 Salt = "n*@if09g3n" )
View Source
const LeastConnection = "least_connection"
View Source
const Random = "random"
View Source
const RoundRobin = "round_robin"
View Source
const (
WeightKey = "weight"
)
Variables ¶
View Source
var ( // ErrNoSubConnAvailable indicates no SubConn is available for pick(). ErrNoSubConnAvailable = errors.New("no SubConn is available") ErrNoContextAvailable = errors.New("no context is available") )
Functions ¶
func DefaultHash ¶
func Register ¶
func Register(b PickerBuilder)
Types ¶
type Address ¶
type Address struct { Name string Addr string // Attributes contains arbitrary data about this address intended for // consumption by the SubConn. Attributes *attributes.Attributes }
type DoneInfo ¶
type DoneInfo struct { // Err is the rpc error the RPC finished with. It could be nil. Err error }
type PickResult ¶
type Picker ¶
type Picker interface {
Pick(info PickInfo) (PickResult, error)
}
func NewErrPicker ¶
NewErrPicker returns a Picker that always returns err on Pick().
type PickerBuildInfo ¶
type PickerBuildInfo struct {
ReadySCs map[any]SubConnInfo
}
type PickerBuilder ¶
type PickerBuilder interface { // Build returns a picker that will be used by client to pick a SubConn.metadata.go Build(info PickerBuildInfo) Picker Name() string }
PickerBuilder creates Picker.
func Builder ¶
func Builder(name string) PickerBuilder
type SubConnInfo ¶
type SubConnInfo struct {
Address Address
}
Click to show internal directories.
Click to hide internal directories.