scache

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2020 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var JudgeActiveNode = NewNodeMap()

Functions

func GetLeafNids

func GetLeafNids(nid int64, exclNid []int64) ([]int64, error)

func Init

func Init()

func RebuildConsistentHashRing

func RebuildConsistentHashRing(hashRing *ConsistentHashRing, nodes []string, replicas int)

func SyncCollects

func SyncCollects()

func SyncStras

func SyncStras()

Types

type CollectCacheMap

type CollectCacheMap struct {
	sync.RWMutex
	Data map[string]*model.Collect
}
var CollectCache *CollectCacheMap

func NewCollectCache

func NewCollectCache() *CollectCacheMap

func (*CollectCacheMap) GetBy

func (c *CollectCacheMap) GetBy(endpoint string) *model.Collect

func (*CollectCacheMap) Set

func (c *CollectCacheMap) Set(endpoint string, collect *model.Collect)

func (*CollectCacheMap) SetAll

func (c *CollectCacheMap) SetAll(strasMap map[string]*model.Collect)

type ConsistentHashRing

type ConsistentHashRing struct {
	sync.RWMutex
	// contains filtered or unexported fields
}
var JudgeHashRing *ConsistentHashRing

func NewConsistentHashRing

func NewConsistentHashRing(replicas int32, nodes []string) *ConsistentHashRing

func (*ConsistentHashRing) GetNode

func (r *ConsistentHashRing) GetNode(pk string) (string, error)

func (*ConsistentHashRing) GetRing

func (*ConsistentHashRing) Set

type NodeMap

type NodeMap struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewNodeMap

func NewNodeMap() NodeMap

func (*NodeMap) GetInstanceBy

func (n *NodeMap) GetInstanceBy(node string) (string, bool)

func (*NodeMap) GetNodeBy

func (n *NodeMap) GetNodeBy(instance string) (string, bool)

func (*NodeMap) GetNodes

func (n *NodeMap) GetNodes() []string

func (*NodeMap) Len

func (n *NodeMap) Len() int

func (*NodeMap) Set

func (n *NodeMap) Set(nodeMap map[string]string)

type StraCacheMap

type StraCacheMap struct {
	sync.RWMutex
	Data map[string][]*model.Stra
}
var StraCache *StraCacheMap

func NewStraCache

func NewStraCache() *StraCacheMap

func (*StraCacheMap) GetAll

func (s *StraCacheMap) GetAll() []*model.Stra

func (*StraCacheMap) GetByNode

func (s *StraCacheMap) GetByNode(node string) []*model.Stra

func (*StraCacheMap) Set

func (s *StraCacheMap) Set(node string, stras []*model.Stra)

func (*StraCacheMap) SetAll

func (s *StraCacheMap) SetAll(strasMap map[string][]*model.Stra)

Jump to

Keyboard shortcuts

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