Пример #1
0
func (this *ConsistentServerSelector) SetServers(servers ...string) error {
	if this.peers == nil {
		this.peers = hash.New(2, nil)
	}

	this.peers.Add(servers...)

	return nil
}
Пример #2
0
func (this *ConsistentServerSelector) SetServers(servers ...string) error {
	if this.nodes == nil {
		this.nodes = hash.New(32, nil) // TODO config replica
	}

	this.nodes.Add(servers...)

	return nil
}
Пример #3
0
func newPeerPicker(self string) PeerPicker {
	return &consistentPeerPicker{peers: hash.New(3, nil), Mutex: new(sync.Mutex),
		self: self}
}
Пример #4
0
func newConsistentPeerSelector() *ConsistentPeerSelector {
	rand.Seed(time.Now().UnixNano())
	return &ConsistentPeerSelector{peers: hash.New(32, nil)} // TODO 32?
}