cockroach: github.com/cockroachdb/cockroach/pkg/kv/kvserver/constraint Index | Files

package constraint

import "github.com/cockroachdb/cockroach/pkg/kv/kvserver/constraint"

Index

Package Files

analyzer.go

func ConjunctionsCheck Uses

func ConjunctionsCheck(store roachpb.StoreDescriptor, constraints []zonepb.Constraint) bool

ConjunctionsCheck checks a store against a single set of constraints (out of the possibly numerous sets that apply to a range), returning true iff the store matches the constraints. The contraints are AND'ed together; a store matches the conjunction if it matches all of them.

type AnalyzedConstraints Uses

type AnalyzedConstraints struct {
    Constraints []zonepb.ConstraintsConjunction
    // True if the per-replica constraints don't fully cover all the desired
    // replicas in the range (sum(constraints.NumReplicas) < zone.NumReplicas).
    // In such cases, we allow replicas that don't match any of the per-replica
    // constraints, but never mark them as necessary.
    UnconstrainedReplicas bool
    // For each conjunction of constraints in the above slice, track which
    // StoreIDs satisfy them. This field is unused if there are no constraints.
    SatisfiedBy [][]roachpb.StoreID
    // Maps from StoreID to the indices in the constraints slice of which
    // constraints the store satisfies. This field is unused if there are no
    // constraints.
    Satisfies map[roachpb.StoreID][]int
}

AnalyzedConstraints represents the result or AnalyzeConstraints(). It combines a zone's constraints with information about which stores satisfy what term of the constraints disjunction.

func AnalyzeConstraints Uses

func AnalyzeConstraints(
    ctx context.Context,
    getStoreDescFn func(roachpb.StoreID) (roachpb.StoreDescriptor, bool),
    existing []roachpb.ReplicaDescriptor,
    zone *zonepb.ZoneConfig,
) AnalyzedConstraints

AnalyzeConstraints processes the zone config constraints that apply to a range along with the current replicas for a range, spitting back out information about which constraints are satisfied by which replicas and which replicas satisfy which constraints, aiding in allocation decisions.

Package constraint imports 3 packages (graph) and is imported by 2 packages. Updated 2020-05-16. Refresh now. Tools for package owners.