Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MaxRelative ¶
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)
Click to show internal directories.
Click to hide internal directories.