opt

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RejectLeader is the label property type that suggests a container should not
	// have any resource leaders.
	RejectLeader = "reject-leader"
)

Variables

This section is empty.

Functions

func AllowBalanceEmptyResource

func AllowBalanceEmptyResource(cluster Cluster) func(*core.CachedResource) bool

AllowBalanceEmptyResource returns a function that checks if a resource is an empty resource and can be balanced.

func HealthAllowPending

func HealthAllowPending(cluster Cluster) func(*core.CachedResource) bool

HealthAllowPending returns a function that checks if a resource is healthy for scheduling. Differs from HealthResource, it allows the resource to have pending peers.

func HealthResource

func HealthResource(cluster Cluster) func(*core.CachedResource) bool

HealthResource returns a function that checks if a resource is healthy for scheduling. It requires the resource does not have any down or pending peers, and does not have any learner peers when placement rules is disabled.

func IsEmptyResourceAllowBalance

func IsEmptyResourceAllowBalance(cluster Cluster, res *core.CachedResource) bool

IsEmptyResourceAllowBalance checks if a region is an empty region and can be balanced.

func IsHealthyAllowPending

func IsHealthyAllowPending(cluster Cluster, res *core.CachedResource) bool

IsHealthyAllowPending checks if a resource is healthy for scheduling. Differs from IsResourceHealthy, it allows the resource to have pending peers.

func IsResourceHealthy

func IsResourceHealthy(cluster Cluster, res *core.CachedResource) bool

IsResourceHealthy checks if a resource is healthy for scheduling. It requires the resource does not have any down or pending peers. And when placement rules feature is disabled, it requires the resource does not have any learner peer.

func IsResourceReplicated

func IsResourceReplicated(cluster Cluster, res *core.CachedResource) bool

IsResourceReplicated checks if a resource is fully replicated. When placement rules is enabled, its peers should fit corresponding rules. When placement rules is disabled, it should have enough replicas and no any learner peer.

func ReplicatedResource

func ReplicatedResource(cluster Cluster) func(*core.CachedResource) bool

ReplicatedResource returns a function that checks if a resource is fully replicated.

Types

type Cluster

type Cluster interface {
	core.ResourceSetInformer
	core.ContainerSetInformer
	core.ContainerSetController
	statistics.ResourceStatInformer
	statistics.ContainerStatInformer

	GetLogger() *zap.Logger
	GetOpts() *config.PersistOptions
	AllocID() (uint64, error)
	FitResource(*core.CachedResource) *placement.ResourceFit
	RemoveScheduler(name string) error
	AddSuspectResources(ids ...uint64)
	GetResourceFactory() func() metadata.Resource

	// just for test
	DisableJointConsensus()
	JointConsensusEnabled() bool
}

Cluster provides an overview of a cluster's resources distribution. TODO: This interface should be moved to a better place.

type HeartbeatStream

type HeartbeatStream interface {
	Send(*rpcpb.ResourceHeartbeatRsp) error
}

HeartbeatStream is an interface.

Jump to

Keyboard shortcuts

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