sender

package
v0.0.0-...-40400fb Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2015 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultProcCronPeriod = time.Duration(5) * time.Second    //ProcCron的周期,默认1s
	DefaultLogCronPeriod  = time.Duration(3600) * time.Second //LogCron的周期,默认300s
)
View Source
const (
	DefaultSendQueueMaxSize = 102400 //10.24w
)
View Source
const (
	DefaultSendTaskSleepInterval = time.Millisecond * 50 //默认睡眠间隔为50ms
)

send

Variables

View Source
var (
	JudgeQueues          = make(map[string]*list.SafeLinkedListLimited)
	GraphQueues          = make(map[string]*list.SafeLinkedListLimited)
	GraphMigratingQueues = make(map[string]*list.SafeLinkedListLimited)
)

发送缓存队列 node -> queue_of_data

View Source
var (
	JudgeConnPools          *cpool.SafeRpcConnPools
	GraphConnPools          *cpool.SafeRpcConnPools
	GraphMigratingConnPools *cpool.SafeRpcConnPools
)

连接池 node_address -> connection_pool

Functions

func DestroyConnPools

func DestroyConnPools()

func KeysOfMap

func KeysOfMap(m map[string]string) []string

TODO 考虑放到公共组件库,或utils库

func Push2GraphSendQueue

func Push2GraphSendQueue(items []*cmodel.MetaData, migrating bool)

将数据 打入 某个Graph的发送缓存队列, 具体是哪一个Graph 由一致性哈希 决定 如果正在数据迁移, 数据除了打到原有配置上 还要向新的配置上打一份(新老重叠时要去重,防止将一条数据向一台Graph上打两次)

func Push2JudgeSendQueue

func Push2JudgeSendQueue(items []*cmodel.MetaData)

将数据 打入 某个Judge的发送缓存队列, 具体是哪一个Judge 由一致性哈希 决定

func Start

func Start()

初始化数据发送服务, 在main函数中调用

Types

type ConsistentHashNodeRing

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

一致性哈希环,用于管理服务器节点.

var (
	JudgeNodeRing          *ConsistentHashNodeRing
	GraphNodeRing          *ConsistentHashNodeRing
	GraphMigratingNodeRing *ConsistentHashNodeRing
)

服务节点的一致性哈希环 pk -> node

func (*ConsistentHashNodeRing) GetNode

func (this *ConsistentHashNodeRing) GetNode(pk string) (string, error)

根据pk,获取node节点. chash(pk) -> node

func (*ConsistentHashNodeRing) SetNodes

func (this *ConsistentHashNodeRing) SetNodes(nodes []string)

func (*ConsistentHashNodeRing) SetNumberOfReplicas

func (this *ConsistentHashNodeRing) SetNumberOfReplicas(num int)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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