Skip to content
Snippets Groups Projects
Commit 741fa29c authored by Josh Brooks's avatar Josh Brooks
Browse files

Implmenet cleanup and constructor for triggers.go

parent c9b4514e
Branches
Tags
4 merge requests!510Release,!207WIP: Client Restructure,!203Symmetric broadcast,!187Xx 3829/triggers
...@@ -48,7 +48,9 @@ type trigger struct { ...@@ -48,7 +48,9 @@ type trigger struct {
func NewTriggers() *TriggersManager { func NewTriggers() *TriggersManager {
// todo: implement me // todo: implement me
return nil return &TriggersManager{
tmap: make(map[id.ID]map[interfaces.Preimage][]trigger, 0),
}
} }
// Lookup will see if a trigger exists for the given preimage and message // Lookup will see if a trigger exists for the given preimage and message
...@@ -59,12 +61,6 @@ func NewTriggers() *TriggersManager { ...@@ -59,12 +61,6 @@ func NewTriggers() *TriggersManager {
// that one or multiple triggers exist to process this message. // that one or multiple triggers exist to process this message.
// These triggers are returned to the caller along with the a true boolean. // These triggers are returned to the caller along with the a true boolean.
// If the map has been exhausted with no matches found, it returns nil and false. // If the map has been exhausted with no matches found, it returns nil and false.
// TODO: reorganize this interface. Lookup needs to be called by handleMessage,
// which should not have access to the other state modifying methods below.
// Possible options include:
// - privatizing the state-changing methods
// - leaking lookup on this layer and migrating the state modification methods
// a layer down in a separate package
func (t *TriggersManager) get(clientID *id.ID, receivedIdentityFp, func (t *TriggersManager) get(clientID *id.ID, receivedIdentityFp,
ecrMsgContents []byte) ([]trigger, ecrMsgContents []byte) ([]trigger,
bool) { bool) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment