cluster

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2022 License: Apache-2.0 Imports: 29 Imported by: 3

Documentation

Index

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 AppendSimpleHostHandler added in v1.1.0

func AppendSimpleHostHandler(c types.Cluster, hostConfigs []v2.Host)

func CleanOldClusterHandler added in v1.1.0

func CleanOldClusterHandler(oc, _ types.Cluster)

func ClearHealthFlag added in v0.12.0

func ClearHealthFlag(p *uint64, flag api.HealthFlag)

func CreateSubset added in v0.23.0

func CreateSubset(hs types.HostSet, predicate types.HostPredicate) types.HostSet

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 GetHealthFlagPointer(addr string) *uint64

func GetOrCreateAddr

func GetOrCreateAddr(addrstr string) net.Addr

func GetOrCreateUDPAddr added in v0.15.0

func GetOrCreateUDPAddr(addrstr string) net.Addr

func HostMatches

func HostMatches(kvs types.SubsetMetadata, host types.Host) bool

func InheritClusterHostsHandler added in v1.1.0

func InheritClusterHostsHandler(oc, nc types.Cluster)

func IsSupportTLS added in v0.12.0

func IsSupportTLS() bool

IsSupportTLS returns the client side is support tls or not default is support

func NewCluster

func NewCluster(clusterConfig v2.Cluster) types.Cluster

func NewClusterInfo added in v1.1.0

func NewClusterInfo(clusterConfig v2.Cluster) types.ClusterInfo

func NewClusterManagerSingleton

func NewClusterManagerSingleton(clusters []v2.Cluster, clusterMap map[string][]v2.Host, tls *v2.TLSConfig) types.ClusterManager

func NewHostSet added in v1.1.0

func NewHostSet(hosts []types.Host) types.HostSet

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 NewNoDistinctHostSet added in v1.1.0

func NewNoDistinctHostSet(hosts []types.Host) types.HostSet

func NewResourceManager

func NewResourceManager(circuitBreakers v2.CircuitBreakers) types.ResourceManager

func NewSimpleHost

func NewSimpleHost(config v2.Host, clusterInfo types.ClusterInfo) types.Host

func NewSimpleHostHandler added in v1.1.0

func NewSimpleHostHandler(c types.Cluster, hostConfigs []v2.Host)

EDS Handler

func NewSubsetLoadBalancer

func NewSubsetLoadBalancer(info types.ClusterInfo, hostSet types.HostSet) types.SubsetLoadBalancer

func NewSubsetLoadBalancerPreIndex added in v1.1.0

func NewSubsetLoadBalancerPreIndex(info types.ClusterInfo, hostSet types.HostSet) types.LoadBalancer

func RegisterClusterType added in v0.13.0

func RegisterClusterType(clusterType v2.ClusterType, f func(v2.Cluster) types.Cluster)

func SetHealthFlag added in v0.12.0

func SetHealthFlag(p *uint64, flag api.HealthFlag)

func SetSubsetBuildMode added in v1.1.0

func SetSubsetBuildMode(mode SubsetBuildMode)

func TraversalLbSubsetMap added in v1.1.0

func TraversalLbSubsetMap(lbs map[string]types.LoadBalancer, prefix string, subsetMap types.LbSubsetMap)

TraversalLbSubsetMap returns all load balancers in subset tree. The map key format is metakey:metavalue->metakey:metavalue...

func UpdateClusterResourceManagerHandler added in v1.1.0

func UpdateClusterResourceManagerHandler(oc, nc types.Cluster)

CDS Handler old cluster maybe nil when cluster is newly created.

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 LessFunc added in v0.27.0

type LessFunc func(a, b *edfEntry) bool

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 (ca *MngAdapter) TriggerClusterAndHostsAddOrUpdate(cluster v2.Cluster, hosts []v2.Host) error

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 (*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 SubsetBuildMode added in v1.1.0

type SubsetBuildMode uint8
const (
	SubsetPreIndexBuildMode SubsetBuildMode = iota
	SubsetFilterBuildMode
)

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
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL