naming

package
v6.0.0-beta.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const NodeReplicas = 500

Variables

View Source
var DatasourceHashRing = DatasourceHashRingType{Rings: make(map[int64]*consistent.Consistent)}

for alert_rule sharding

Functions

func NewConsistentHashRing

func NewConsistentHashRing(replicas int32, nodes []string) *consistent.Consistent

func RebuildConsistentHashRing

func RebuildConsistentHashRing(datasourceId int64, nodes []string)

Types

type DatasourceHashRingType

type DatasourceHashRingType struct {
	sync.RWMutex
	Rings map[int64]*consistent.Consistent
}

func (*DatasourceHashRingType) GetNode

func (chr *DatasourceHashRingType) GetNode(datasourceId int64, pk string) (string, error)

func (*DatasourceHashRingType) IsHit

func (chr *DatasourceHashRingType) IsHit(datasourceId int64, pk string, currentNode string) bool

func (*DatasourceHashRingType) Set

func (chr *DatasourceHashRingType) Set(datasourceId int64, r *consistent.Consistent)

type Naming

type Naming struct {
	Heartbeat aconf.HeartbeatConfig
	// contains filtered or unexported fields
}

func NewNaming

func NewNaming(ctx *ctx.Context, heartbeat aconf.HeartbeatConfig) *Naming

func (*Naming) ActiveServers

func (n *Naming) ActiveServers(datasourceId int64) ([]string, error)

func (*Naming) AllActiveServers

func (n *Naming) AllActiveServers() ([]string, error)

func (*Naming) DeleteInactiveInstances

func (n *Naming) DeleteInactiveInstances()

func (*Naming) Heartbeats

func (n *Naming) Heartbeats() error

func (*Naming) IamLeader

func (n *Naming) IamLeader() bool

Jump to

Keyboard shortcuts

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