Example #1
0
func (h addTriggerHandler) Rcv(msg bh.Msg, ctx bh.RcvContext) error {
	add := msg.Data().(nom.AddTrigger)
	dict := ctx.Dict(triggersDict)
	var nt nodeTriggers
	if v, err := dict.Get(string(add.Node)); err == nil {
		nt = v.(nodeTriggers)
	}
	nt.maybeAddTrigger(nom.Trigger(add))
	return dict.Put(string(add.Node), nt)
}
Example #2
0
func (h delTriggerHandler) Rcv(msg bh.Msg, ctx bh.RcvContext) error {
	del := msg.Data().(nom.DelTrigger)
	var nt nodeTriggers
	dict := ctx.Dict(triggersDict)
	if v, err := dict.Get(string(del.Node)); err == nil {
		nt = v.(nodeTriggers)
	}
	nt.delTrigger(nom.Trigger(del))
	return dict.Put(string(del.Node), nt)
}