Example #1
0
func (t *tribe) handleMemberJoin(n *memberlist.Node) {
	t.mutex.Lock()
	defer t.mutex.Unlock()
	if _, ok := t.members[n.Name]; !ok {
		t.members[n.Name] = agreement.NewMember(n)
		t.members[n.Name].Tags = t.decodeTags(n.Meta)
	}
	t.processIntents()
}
Example #2
0
func init() {
	mockTribeAgreement = agreement.New("Agree1")
	mockTribeAgreement.PluginAgreement.Add(
		agreement.Plugin{Name_: "mockVersion", Version_: 1, Type_: core.CollectorPluginType})
	mockTribeAgreement.TaskAgreement.Add(
		agreement.Task{ID: "mockTask", StartOnCreate: true})
	mockTribeAgreement.Members["member1"] = agreement.NewMember(&memberlist.Node{
		Name: "mockName",
		Addr: net.ParseIP("193.34.23.11"),
		Port: uint16(0),
		Meta: []byte("meta"), // Metadata from the delegate for this node.
		PMin: uint8(0),       // Minimum protocol version this understands
		PMax: uint8(0),       // Maximum protocol version this understands
		PCur: uint8(0),       // Current version node is speaking
		DMin: uint8(0),       // Min protocol version for the delegate to understand
		DMax: uint8(0),       // Max protocol version for the delegate to understand
		DCur: uint8(0),       // Current version delegate is speaking
	})
}