provider

package
v0.0.0-...-c1c7cdf Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2025 License: PostgreSQL Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MaxRelative

func MaxRelative(metrics, threshold []float64) (val float64, kind int)

Types

type BalancerImpl

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

func NewBalancer

func NewBalancer() (*BalancerImpl, error)

NewBalancer creates new instance of BalancerImpl.

Returns:

  • *BalancerImpl: new balancer instance.
  • error: an error if any occured.

func (*BalancerImpl) RunBalancer

func (b *BalancerImpl) RunBalancer(ctx context.Context)

RunBalancer is the main function of balancer.Balancer. Firstly, it checks if there is a current unfinished balancer task in QDB. If none is found, it checks the shards and creates a new task if needed. Then, if there's a relevant task, BalancerImpl will move the amount of data specified in the task.

Parameters:

  • ctx (context.Context): the context of the operation.

type HostMetrics

type HostMetrics []float64

func NewHostMetrics

func NewHostMetrics() HostMetrics

func (HostMetrics) MaxRelative

func (m HostMetrics) MaxRelative(threshold []float64) (val float64)

type ShardMetrics

type ShardMetrics struct {
	ShardId       string
	MetricsTotal  []float64
	MetricsKR     map[string][]float64 // mean value for object by key range
	KeyCountKR    map[string]int64
	KeyCountRelKR map[string]map[string]int64
	Master        string
	TargetReplica string
}

func NewShardMetrics

func NewShardMetrics() *ShardMetrics

func (*ShardMetrics) SetMasterMetrics

func (m *ShardMetrics) SetMasterMetrics(metrics HostMetrics)

func (*ShardMetrics) SetReplicaMetrics

func (m *ShardMetrics) SetReplicaMetrics(metrics HostMetrics)

Jump to

Keyboard shortcuts

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