|
|
@ -1,36 +1,26 @@
|
|
|
|
package graphvent
|
|
|
|
package graphvent
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
type GroupExt struct {
|
|
|
|
var GroupReadPolicy = NewAllNodesPolicy(Tree{
|
|
|
|
Members map[NodeID]string `gv:"members"`
|
|
|
|
SerializedType(ReadSignalType): {
|
|
|
|
}
|
|
|
|
SerializedType(GroupExtType): {
|
|
|
|
|
|
|
|
Hash(FieldNameBase, "members"): nil,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
func (ext *GroupExt) Type() ExtType {
|
|
|
|
type GroupExt struct {
|
|
|
|
return GroupExtType
|
|
|
|
Members []NodeID `gv:"members"`
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (ext *GroupExt) MarshalBinary() ([]byte, error) {
|
|
|
|
|
|
|
|
return json.Marshal(ext)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func NewGroupExt(members map[NodeID]string) *GroupExt {
|
|
|
|
func NewGroupExt(members []NodeID) *GroupExt {
|
|
|
|
if members == nil {
|
|
|
|
|
|
|
|
members = map[NodeID]string{}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return &GroupExt{
|
|
|
|
return &GroupExt{
|
|
|
|
Members: members,
|
|
|
|
Members: members,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (ext *GroupExt) Deserialize(ctx *Context, data []byte) error {
|
|
|
|
|
|
|
|
ext.Members = map[NodeID]string{}
|
|
|
|
|
|
|
|
return json.Unmarshal(data, ext)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (ext *GroupExt) Process(ctx *Context, node *Node, source NodeID, signal Signal) Messages {
|
|
|
|
func (ext *GroupExt) Process(ctx *Context, node *Node, source NodeID, signal Signal) Messages {
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|