Пример #1
0
func (m *msgRingPullReplicationTester) MsgToOtherReplicas(ringVersion int64, partition uint32, msg ring.Msg) {
	prm, ok := msg.(*pullReplicationMsg)
	if ok {
		m.lock.Lock()
		h := make([]byte, len(prm.header))
		copy(h, prm.header)
		m.headerToPartitions = append(m.headerToPartitions, h)
		b := make([]byte, len(prm.body))
		copy(b, prm.body)
		m.bodyToPartitions = append(m.bodyToPartitions, b)
		m.lock.Unlock()
	}
	msg.Done()
}
Пример #2
0
func (m *msgRingPlaceholder) MsgToOtherReplicas(ringVersion int64, partition uint32, msg ring.Msg) {
	m.lock.Lock()
	m.msgToPartitions = append(m.msgToPartitions, partition)
	m.lock.Unlock()
	msg.Done()
}
Пример #3
0
func (m *msgRingPlaceholder) MsgToNode(nodeID uint64, msg ring.Msg) {
	m.lock.Lock()
	m.msgToNodeIDs = append(m.msgToNodeIDs, nodeID)
	m.lock.Unlock()
	msg.Done()
}
Пример #4
0
func (m *msgRingPullReplicationTester) MsgToNode(nodeID uint64, msg ring.Msg) {
	m.lock.Lock()
	m.msgToNodeIDs = append(m.msgToNodeIDs, nodeID)
	m.lock.Unlock()
	msg.Done()
}