Documentation ¶
Index ¶
- Constants
- Variables
- func ClearHealthFlag(p *uint64, flag api.HealthFlag)
- func CreateSubset(hosts []types.Host, predicate types.HostPredicate) types.HostSet
- func DisableClientSideTLS()
- func EnableClientSideTLS()
- func ExtractSubsetMetadata(subsetKeys []string, metadata api.Metadata, kvs types.SubsetMetadata) types.SubsetMetadata
- func GenerateSubsetKeys(keysArray [][]string) []types.SortedStringSetType
- func GetHealthFlagPointer(addr string) *uint64
- func GetOrCreateAddr(addrstr string) net.Addr
- func GetOrCreateUDPAddr(addrstr string) net.Addr
- func HostMatches(kvs types.SubsetMetadata, host types.Host) bool
- func IsSupportTLS() bool
- func NewCluster(clusterConfig v2.Cluster) types.Cluster
- func NewClusterManagerSingleton(clusters []v2.Cluster, clusterMap map[string][]v2.Host, tls *v2.TLSConfig) types.ClusterManager
- func NewLBOriDstInfo(oridstCfg *v2.LBOriDstConfig) types.LBOriDstInfo
- func NewLBSubsetInfo(subsetCfg *v2.LBSubsetConfig) types.LBSubsetInfo
- func NewLoadBalancer(info types.ClusterInfo, hosts types.HostSet) types.LoadBalancer
- func NewResourceManager(circuitBreakers v2.CircuitBreakers) types.ResourceManager
- func NewSimpleHost(config v2.Host, clusterInfo types.ClusterInfo) types.Host
- func NewSubsetLoadBalancer(info types.ClusterInfo, hostSet types.HostSet) types.LoadBalancer
- func RegisterClusterType(clusterType v2.ClusterType, f func(v2.Cluster) types.Cluster)
- func RegisterLBType(lbType types.LoadBalancerType, ...)
- func SetHealthFlag(p *uint64, flag api.HealthFlag)
- type EdfLoadBalancer
- type LBOriDstInfoImpl
- type LBSubsetEntryImpl
- func (entry *LBSubsetEntryImpl) Active() bool
- func (entry *LBSubsetEntryImpl) Children() types.LbSubsetMap
- func (entry *LBSubsetEntryImpl) CreateLoadBalancer(info types.ClusterInfo, hosts types.HostSet)
- func (entry *LBSubsetEntryImpl) HostNum() int
- func (entry *LBSubsetEntryImpl) Initialized() bool
- func (entry *LBSubsetEntryImpl) LoadBalancer() types.LoadBalancer
- type LBSubsetInfoImpl
- type LessFunc
- type MngAdapter
- func (ca *MngAdapter) TriggerClusterAddOrUpdate(cluster v2.Cluster) error
- func (ca *MngAdapter) TriggerClusterAndHostsAddOrUpdate(cluster v2.Cluster, hosts []v2.Host) error
- func (ca *MngAdapter) TriggerClusterDel(clusterNames ...string) error
- func (ca *MngAdapter) TriggerClusterHostUpdate(clusterName string, hosts []v2.Host) error
- func (ca *MngAdapter) TriggerHostAppend(clusterName string, hostAppend []v2.Host) error
- func (ca *MngAdapter) TriggerHostDel(clusterName string, hosts []string) error
- type OriginalDstLoadBalancer
- type ResolveTarget
- type WRRLoadBalancer
- type WeightItem
Constants ¶
View Source
const ( DefaultMaxConnections uint64 = 0 DefaultMaxPendingRequests uint64 = 0 DefaultMaxRequests uint64 = 0 DefaultMaxRetries uint64 = 0 )
default value is zero
Variables ¶
View Source
var AddrStore *utils.ExpiredMap = utils.NewExpiredMap( func(key interface{}) (interface{}, bool) { addr, err := net.ResolveTCPAddr("tcp", key.(string)) if err == nil { return addr, true } return nil, false }, false)
net.Addr reuse for same address, valid in simple type Update DNS cache using asynchronous mode
View Source
var DefaultRefreshInterval time.Duration = 5 * time.Second
View Source
var DefaultRefreshTimeout time.Duration = 20 * time.Second
View Source
var UDPAddrStore *utils.ExpiredMap = utils.NewExpiredMap( func(key interface{}) (interface{}, bool) { addr, err := net.ResolveUDPAddr("udp", key.(string)) if err == nil { return addr, true } return nil, false }, false)
store resolved UDP addr
View Source
var (
VarProxyUpstreamIndex = "upstream_index"
)
Functions ¶
func ClearHealthFlag ¶ added in v0.12.0
func ClearHealthFlag(p *uint64, flag api.HealthFlag)
func CreateSubset ¶ added in v0.23.0
func DisableClientSideTLS ¶ added in v0.12.0
func DisableClientSideTLS()
func EnableClientSideTLS ¶ added in v0.12.0
func EnableClientSideTLS()
func ExtractSubsetMetadata ¶
func ExtractSubsetMetadata(subsetKeys []string, metadata api.Metadata, kvs types.SubsetMetadata) types.SubsetMetadata
if subsetKeys are all contained in the host metadata
func GenerateSubsetKeys ¶
func GenerateSubsetKeys(keysArray [][]string) []types.SortedStringSetType
func GetHealthFlagPointer ¶ added in v0.12.0
func GetOrCreateAddr ¶
func GetOrCreateUDPAddr ¶ added in v0.15.0
func HostMatches ¶
func HostMatches(kvs types.SubsetMetadata, host types.Host) bool
func IsSupportTLS ¶ added in v0.12.0
func IsSupportTLS() bool
IsSupportTLS returns the client side is support tls or not default is support
func NewLBOriDstInfo ¶ added in v0.11.0
func NewLBOriDstInfo(oridstCfg *v2.LBOriDstConfig) types.LBOriDstInfo
func NewLBSubsetInfo ¶
func NewLBSubsetInfo(subsetCfg *v2.LBSubsetConfig) types.LBSubsetInfo
func NewLoadBalancer ¶
func NewLoadBalancer(info types.ClusterInfo, hosts types.HostSet) types.LoadBalancer
func NewResourceManager ¶
func NewResourceManager(circuitBreakers v2.CircuitBreakers) types.ResourceManager
func NewSimpleHost ¶
func NewSubsetLoadBalancer ¶
func NewSubsetLoadBalancer(info types.ClusterInfo, hostSet types.HostSet) types.LoadBalancer
func RegisterClusterType ¶ added in v0.13.0
func RegisterLBType ¶
func RegisterLBType(lbType types.LoadBalancerType, f func(types.ClusterInfo, types.HostSet) types.LoadBalancer)
func SetHealthFlag ¶ added in v0.12.0
func SetHealthFlag(p *uint64, flag api.HealthFlag)
Types ¶
type EdfLoadBalancer ¶ added in v0.12.0
type EdfLoadBalancer struct {
// contains filtered or unexported fields
}
func (*EdfLoadBalancer) ChooseHost ¶ added in v0.12.0
func (lb *EdfLoadBalancer) ChooseHost(context types.LoadBalancerContext) types.Host
func (*EdfLoadBalancer) HostNum ¶ added in v0.12.0
func (lb *EdfLoadBalancer) HostNum(metadata api.MetadataMatchCriteria) int
func (*EdfLoadBalancer) IsExistsHosts ¶ added in v0.12.0
func (lb *EdfLoadBalancer) IsExistsHosts(metadata api.MetadataMatchCriteria) bool
type LBOriDstInfoImpl ¶ added in v0.11.0
type LBOriDstInfoImpl struct {
// contains filtered or unexported fields
}
func (*LBOriDstInfoImpl) GetHeader ¶ added in v0.11.0
func (info *LBOriDstInfoImpl) GetHeader() string
func (*LBOriDstInfoImpl) IsEnabled ¶ added in v0.11.0
func (info *LBOriDstInfoImpl) IsEnabled() bool
func (*LBOriDstInfoImpl) IsReplaceLocal ¶ added in v0.27.0
func (info *LBOriDstInfoImpl) IsReplaceLocal() bool
type LBSubsetEntryImpl ¶
type LBSubsetEntryImpl struct {
// contains filtered or unexported fields
}
func (*LBSubsetEntryImpl) Active ¶
func (entry *LBSubsetEntryImpl) Active() bool
func (*LBSubsetEntryImpl) Children ¶
func (entry *LBSubsetEntryImpl) Children() types.LbSubsetMap
func (*LBSubsetEntryImpl) CreateLoadBalancer ¶
func (entry *LBSubsetEntryImpl) CreateLoadBalancer(info types.ClusterInfo, hosts types.HostSet)
func (*LBSubsetEntryImpl) HostNum ¶
func (entry *LBSubsetEntryImpl) HostNum() int
func (*LBSubsetEntryImpl) Initialized ¶
func (entry *LBSubsetEntryImpl) Initialized() bool
func (*LBSubsetEntryImpl) LoadBalancer ¶
func (entry *LBSubsetEntryImpl) LoadBalancer() types.LoadBalancer
type LBSubsetInfoImpl ¶
type LBSubsetInfoImpl struct {
// contains filtered or unexported fields
}
func (*LBSubsetInfoImpl) DefaultSubset ¶
func (info *LBSubsetInfoImpl) DefaultSubset() types.SubsetMetadata
func (*LBSubsetInfoImpl) FallbackPolicy ¶
func (info *LBSubsetInfoImpl) FallbackPolicy() types.FallBackPolicy
func (*LBSubsetInfoImpl) IsEnabled ¶
func (info *LBSubsetInfoImpl) IsEnabled() bool
func (*LBSubsetInfoImpl) SubsetKeys ¶
func (info *LBSubsetInfoImpl) SubsetKeys() []types.SortedStringSetType
type MngAdapter ¶
type MngAdapter struct {
types.ClusterManager
}
cluster adapter wrapper cluster manager the adapter can call clustermanager directly but at most time, we call the wrapper functions
func GetClusterMngAdapterInstance ¶
func GetClusterMngAdapterInstance() *MngAdapter
func (*MngAdapter) TriggerClusterAddOrUpdate ¶
func (ca *MngAdapter) TriggerClusterAddOrUpdate(cluster v2.Cluster) error
func (*MngAdapter) TriggerClusterAndHostsAddOrUpdate ¶
func (*MngAdapter) TriggerClusterDel ¶
func (ca *MngAdapter) TriggerClusterDel(clusterNames ...string) error
func (*MngAdapter) TriggerClusterHostUpdate ¶
func (ca *MngAdapter) TriggerClusterHostUpdate(clusterName string, hosts []v2.Host) error
func (*MngAdapter) TriggerHostAppend ¶
func (ca *MngAdapter) TriggerHostAppend(clusterName string, hostAppend []v2.Host) error
func (*MngAdapter) TriggerHostDel ¶
func (ca *MngAdapter) TriggerHostDel(clusterName string, hosts []string) error
type OriginalDstLoadBalancer ¶ added in v0.11.0
type OriginalDstLoadBalancer struct {
// contains filtered or unexported fields
}
LoadBalancer Implementations
func (*OriginalDstLoadBalancer) ChooseHost ¶ added in v0.11.0
func (lb *OriginalDstLoadBalancer) ChooseHost(lbCtx types.LoadBalancerContext) types.Host
func (*OriginalDstLoadBalancer) HostNum ¶ added in v0.11.0
func (lb *OriginalDstLoadBalancer) HostNum(metadata api.MetadataMatchCriteria) int
func (*OriginalDstLoadBalancer) IsExistsHosts ¶ added in v0.11.0
func (lb *OriginalDstLoadBalancer) IsExistsHosts(metadata api.MetadataMatchCriteria) bool
type ResolveTarget ¶ added in v0.13.0
type ResolveTarget struct {
// contains filtered or unexported fields
}
func (*ResolveTarget) OnResolve ¶ added in v0.13.0
func (rt *ResolveTarget) OnResolve()
func (*ResolveTarget) OnTimeout ¶ added in v0.13.0
func (rt *ResolveTarget) OnTimeout()
func (*ResolveTarget) StartResolve ¶ added in v0.13.0
func (rt *ResolveTarget) StartResolve()
func (*ResolveTarget) StopResolve ¶ added in v0.13.0
func (rt *ResolveTarget) StopResolve()
type WRRLoadBalancer ¶ added in v0.13.0
type WRRLoadBalancer struct { *EdfLoadBalancer // contains filtered or unexported fields }
A round robin load balancer. When in weighted mode, EDF scheduling is used. When in not weighted mode, simple RR index selection is used.
func (*WRRLoadBalancer) HostNum ¶ added in v0.13.0
func (lb *WRRLoadBalancer) HostNum(metadata api.MetadataMatchCriteria) int
func (*WRRLoadBalancer) IsExistsHosts ¶ added in v0.13.0
func (lb *WRRLoadBalancer) IsExistsHosts(metadata api.MetadataMatchCriteria) bool
type WeightItem ¶ added in v0.12.0
type WeightItem interface {
Weight() uint32
}
Click to show internal directories.
Click to hide internal directories.