diff options
author | Valery Piashchynski <[email protected]> | 2021-01-27 13:56:28 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-01-27 13:56:28 +0300 |
commit | 744c2b0c86b88f77e681f8660bf3a476e83711b8 (patch) | |
tree | f7af7d7d494d1f5ca272af1ad0b978fe44d685a9 /plugins/temporal/workflow/id_registry.go | |
parent | e2266b80db47444ba5858c736833a8a81b1361ad (diff) |
Move temporal plugin to the temporal repository
Diffstat (limited to 'plugins/temporal/workflow/id_registry.go')
-rw-r--r-- | plugins/temporal/workflow/id_registry.go | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/plugins/temporal/workflow/id_registry.go b/plugins/temporal/workflow/id_registry.go deleted file mode 100644 index ac75cbda..00000000 --- a/plugins/temporal/workflow/id_registry.go +++ /dev/null @@ -1,51 +0,0 @@ -package workflow - -import ( - "sync" - - bindings "go.temporal.io/sdk/internalbindings" -) - -// used to gain access to child workflow ids after they become available via callback result. -type idRegistry struct { - mu sync.Mutex - ids map[uint64]entry - listeners map[uint64]listener -} - -type listener func(w bindings.WorkflowExecution, err error) - -type entry struct { - w bindings.WorkflowExecution - err error -} - -func newIDRegistry() *idRegistry { - return &idRegistry{ - ids: map[uint64]entry{}, - listeners: map[uint64]listener{}, - } -} - -func (c *idRegistry) listen(id uint64, cl listener) { - c.mu.Lock() - defer c.mu.Unlock() - - c.listeners[id] = cl - - if e, ok := c.ids[id]; ok { - cl(e.w, e.err) - } -} - -func (c *idRegistry) push(id uint64, w bindings.WorkflowExecution, err error) { - c.mu.Lock() - defer c.mu.Unlock() - - e := entry{w: w, err: err} - c.ids[id] = e - - if l, ok := c.listeners[id]; ok { - l(e.w, e.err) - } -} |