prio

package
v1.8.1-0...-0157f87 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcPriorityForAgent

func CalcPriorityForAgent(
	agent *topo.AgentStat,
	cfgPrio config.Priority,
	coeffRules map[string]float64,
) float64

CalcPriorityForAgent calculates priority for the specified agent.

func CalcPriorityForNode

func CalcPriorityForNode(node *topo.NodeInfo) float64

CalcPriorityForNode returns implicit priority based on node info.

Types

type NodesPriority

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

NodesPriority groups nodes by priority according to provided scores. Basically nodes are grouped and sorted by descending order by score

func CalcNodesPriority

func CalcNodesPriority(
	c map[string]float64,
	cfgPrio config.Priority,
	agents []topo.AgentStat,
) *NodesPriority

CalcNodesPriority calculates and returns list nodes grouped by backup/pitr preferences in descended order. First are nodes with the highest priority. Custom coefficients might be passed. These will be ignored though if the config is set.

func NewNodesPriority

func NewNodesPriority() *NodesPriority

func (*NodesPriority) Add

func (n *NodesPriority) Add(rs, node string, sc float64)

Add node with its score

func (*NodesPriority) RS

func (n *NodesPriority) RS(rs string) [][]string

RS returns nodes `group and sort desc by score` for given replset

Jump to

Keyboard shortcuts

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