checker

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllowMerge

func AllowMerge(cluster opt.Cluster, res *core.CachedResource, adjacent *core.CachedResource) bool

AllowMerge returns true if two resources can be merged according to the key type.

Types

type JointStateChecker

type JointStateChecker struct {
	// contains filtered or unexported fields
}

JointStateChecker ensures resource is in joint state will leave.

func NewJointStateChecker

func NewJointStateChecker(cluster opt.Cluster) *JointStateChecker

NewJointStateChecker creates a joint state checker.

func (*JointStateChecker) Check

Check verifies a resource's role, creating an Operator if need.

type LearnerChecker

type LearnerChecker struct {
	// contains filtered or unexported fields
}

LearnerChecker ensures resource has a learner will be promoted.

func NewLearnerChecker

func NewLearnerChecker(cluster opt.Cluster) *LearnerChecker

NewLearnerChecker creates a learner checker.

func (*LearnerChecker) Check

Check verifies a resource's role, creating an Operator if need.

type MergeChecker

type MergeChecker struct {
	// contains filtered or unexported fields
}

MergeChecker ensures resource to merge with adjacent resource when size is small

func NewMergeChecker

func NewMergeChecker(ctx context.Context, cluster opt.Cluster) *MergeChecker

NewMergeChecker creates a merge checker.

func (*MergeChecker) Check

func (m *MergeChecker) Check(res *core.CachedResource) []*operator.Operator

Check verifies a resource's replicas, creating an Operator if need.

func (*MergeChecker) RecordResourceSplit

func (m *MergeChecker) RecordResourceSplit(resourceIDs []uint64)

RecordResourceSplit put the recently split resource into cache. MergeChecker will skip check it for a while.

type ReplicaChecker

type ReplicaChecker struct {
	// contains filtered or unexported fields
}

ReplicaChecker ensures resource has the best replicas. Including the following: Replica number management. Unhealthy replica management, mainly used for disaster recovery of your storage application. Location management, mainly used for cross data center deployment.

func NewReplicaChecker

func NewReplicaChecker(cluster opt.Cluster, resourceWaitingList cache.Cache) *ReplicaChecker

NewReplicaChecker creates a replica checker.

func (*ReplicaChecker) Check

Check verifies a resource's replicas, creating an operator.Operator if need.

type ReplicaStrategy

type ReplicaStrategy struct {
	// contains filtered or unexported fields
}

ReplicaStrategy collects some utilities to manipulate resource peers. It exists to allow replica_checker and rule_checker to reuse common logics.

func (*ReplicaStrategy) SelectContainerToAdd

func (s *ReplicaStrategy) SelectContainerToAdd(coLocationContainers []*core.CachedContainer, extraFilters ...filter.Filter) uint64

SelectContainerToAdd returns the container to add a replica to a resource. `coLocationContainers` are the containers used to compare location with target container. `extraFilters` is used to set up more filters based on the context that calling this method.

For example, to select a target container to replace a resource's peer, we can use the peer list with the peer removed as `coLocationContainers`. Meanwhile, we need to provide more constraints to ensure that the isolation level cannot be reduced after replacement.

func (*ReplicaStrategy) SelectContainerToImprove

func (s *ReplicaStrategy) SelectContainerToImprove(coLocationContainers []*core.CachedContainer, old uint64) uint64

SelectContainerToImprove returns a container to replace oldContainer. The location placement after scheduling should be better than original.

func (*ReplicaStrategy) SelectContainerToRemove

func (s *ReplicaStrategy) SelectContainerToRemove(coLocationContainers []*core.CachedContainer) uint64

SelectContainerToRemove returns the best option to remove from the resource.

func (*ReplicaStrategy) SelectContainerToReplace

func (s *ReplicaStrategy) SelectContainerToReplace(coLocationContainers []*core.CachedContainer, old uint64) uint64

SelectContainerToReplace returns a container to replace oldContainer. The location placement after scheduling should be not worse than original.

type RuleChecker

type RuleChecker struct {
	// contains filtered or unexported fields
}

RuleChecker fix/improve resource by placement rules.

func NewRuleChecker

func NewRuleChecker(cluster opt.Cluster, ruleManager *placement.RuleManager, resourceWaitingList cache.Cache) *RuleChecker

NewRuleChecker creates a checker instance.

func (*RuleChecker) Check

Check checks if the resource matches placement rules and returns Operator to fix it.

Jump to

Keyboard shortcuts

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