Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AndRequirement ¶
type AndRequirement struct {
Requirements []placement.Requirement
}
AndRequirement represents an "and" of a set of sub affinity requirements which can be another and, or, label or relation requirement.
An example initialization could be:
requirement := NewAndRequirement( subRequirement1, subRequirement2, ... )
func NewAndRequirement ¶
func NewAndRequirement(requirements ...placement.Requirement) *AndRequirement
NewAndRequirement creates a new and requirement.
func (*AndRequirement) Composite ¶
func (requirement *AndRequirement) Composite() (bool, string)
Composite returns true as the requirement is composite and the name of its composite nature.
func (*AndRequirement) Passed ¶
func (requirement *AndRequirement) Passed(group *placement.Group, scopeSet *placement.ScopeSet, entity *placement.Entity, transcript *placement.Transcript) bool
Passed checks if the requirement is fulfilled by the given group within the scope groups.
func (*AndRequirement) String ¶
func (requirement *AndRequirement) String() string
type Comparison ¶
type Comparison string
Comparison represents a condition on two numbers.
const ( // LessThan requires the occurrences of a label to be less than (<) the required occurrences. LessThan Comparison = "less_than" // LessThanEqual requires the occurrences of a label to be less than or equal to (<=) the required occurrences. LessThanEqual Comparison = "less_than_equal" // Equal requires the occurrences of a label to be equal to (=) the required occurrences. Equal Comparison = "equal" // GreaterThanEqual requires the occurrences of a label to be greater than or equal to (>=) the required occurrences. GreaterThanEqual Comparison = "greater_than_equal" // GreaterThan requires the occurrences of a label to be greater than (>) the required occurrences. GreaterThan Comparison = "greater_than" )
type LabelRequirement ¶
type LabelRequirement struct { Scope *labels.Label Label *labels.Label Comparison Comparison Occurrences int }
LabelRequirement represents a requirement in relation to a specific group having a specific label, i.e. we want to be placed in a given data center or we do not want to be placed on a specific rack, etc.
An example initialization could be:
requirement := NewLabelRequirement( labels.NewLabel("host", "*"), labels.NewLabel("volume-types", "zfs"), Equal, 1, )
which applies to any group that is a host and requires that there is exactly 1 occurrence of the label volume-types.zfs on the group.
func NewLabelRequirement ¶
func NewLabelRequirement(scope, label *labels.Label, comparison Comparison, occurrences int) *LabelRequirement
NewLabelRequirement creates a new label requirement.
func (*LabelRequirement) Composite ¶
func (requirement *LabelRequirement) Composite() (bool, string)
Composite returns false as the requirement is not composite and the name of the requirement type.
func (*LabelRequirement) Passed ¶
func (requirement *LabelRequirement) Passed(group *placement.Group, scopeSet *placement.ScopeSet, entity *placement.Entity, transcript *placement.Transcript) bool
Passed checks if the requirement is fulfilled by the given group within the scope groups.
func (*LabelRequirement) String ¶
func (requirement *LabelRequirement) String() string
type MetricRequirement ¶
type MetricRequirement struct { MetricType metrics.Type Comparison Comparison Value float64 }
MetricRequirement represents a hard requirement for placing a Database in a given PlacementGroup which should have certain requirements for a specific metric.
An example initialization could be:
requirement := NewMetricRequirement( metrics.DiskFree, GreaterThanEqual, 256*metrics.GiB, )
which requires that the group should have 256 GiB or more of the metric disk free.
func NewMetricRequirement ¶
func NewMetricRequirement(metricType metrics.Type, comparison Comparison, value float64) *MetricRequirement
NewMetricRequirement creates a new metric requirement.
func (*MetricRequirement) Composite ¶
func (requirement *MetricRequirement) Composite() (bool, string)
Composite returns false as the requirement is not composite and the name of the requirement type.
func (*MetricRequirement) Passed ¶
func (requirement *MetricRequirement) Passed(group *placement.Group, scopeSet *placement.ScopeSet, entity *placement.Entity, transcript *placement.Transcript) bool
Passed checks if the requirement is fulfilled by the given group within the scope groups.
func (*MetricRequirement) String ¶
func (requirement *MetricRequirement) String() string
type OrRequirement ¶
type OrRequirement struct {
Requirements []placement.Requirement
}
OrRequirement represents an "or" of a set of sub affinity requirements which can be another or, and, label or relation requirement.
An example initialization could be:
requirement := NewOrRequirement( subRequirement1, subRequirement2, ... )
func NewOrRequirement ¶
func NewOrRequirement(requirements ...placement.Requirement) *OrRequirement
NewOrRequirement creates a new or requirement.
func (*OrRequirement) Composite ¶
func (requirement *OrRequirement) Composite() (bool, string)
Composite returns true as the requirement is composite and the name of its composite nature.
func (*OrRequirement) Passed ¶
func (requirement *OrRequirement) Passed(group *placement.Group, scopeSet *placement.ScopeSet, entity *placement.Entity, transcript *placement.Transcript) bool
Passed checks if the requirement is fulfilled by the given group within the scope groups.
func (*OrRequirement) String ¶
func (requirement *OrRequirement) String() string
type RelationRequirement ¶
type RelationRequirement struct { Scope *labels.Label Relation *labels.Label Comparison Comparison Occurrences int }
RelationRequirement represents a requirement on the number of occurrences for a specific relation on a group. The requirement will only apply if the group contains the applies to label.
An example initialization could be:
requirement := NewRelationRequirement( labels.NewLabel("rack", "dc1-a009"), labels.NewLabel("redis", "instance", "store1"), LessThanEqual, 0, )
which only applies to groups in rack dc1-a009 and requires that there are 0 or less occurrences of the relation redis.instance.store1 on the group.
func NewRelationRequirement ¶
func NewRelationRequirement(scope, relation *labels.Label, comparison Comparison, occurrences int) *RelationRequirement
NewRelationRequirement creates a new relation requirement.
func (*RelationRequirement) Composite ¶
func (requirement *RelationRequirement) Composite() (bool, string)
Composite returns false as the requirement is not composite and the name of the requirement type.
func (*RelationRequirement) Passed ¶
func (requirement *RelationRequirement) Passed(group *placement.Group, scopeSet *placement.ScopeSet, entity *placement.Entity, transcript *placement.Transcript) bool
Passed checks if the requirement is fulfilled by the given group within the scope groups.
func (*RelationRequirement) String ¶
func (requirement *RelationRequirement) String() string