summaryrefslogtreecommitdiff
path: root/plugins/temporal/workflow/message_queue.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-01-27 13:56:28 +0300
committerValery Piashchynski <[email protected]>2021-01-27 13:56:28 +0300
commit744c2b0c86b88f77e681f8660bf3a476e83711b8 (patch)
treef7af7d7d494d1f5ca272af1ad0b978fe44d685a9 /plugins/temporal/workflow/message_queue.go
parente2266b80db47444ba5858c736833a8a81b1361ad (diff)
Move temporal plugin to the temporal repository
Diffstat (limited to 'plugins/temporal/workflow/message_queue.go')
-rw-r--r--plugins/temporal/workflow/message_queue.go47
1 files changed, 0 insertions, 47 deletions
diff --git a/plugins/temporal/workflow/message_queue.go b/plugins/temporal/workflow/message_queue.go
deleted file mode 100644
index 8f4409d1..00000000
--- a/plugins/temporal/workflow/message_queue.go
+++ /dev/null
@@ -1,47 +0,0 @@
-package workflow
-
-import (
- rrt "github.com/spiral/roadrunner/v2/plugins/temporal/protocol"
- "go.temporal.io/api/common/v1"
- "go.temporal.io/api/failure/v1"
-)
-
-type messageQueue struct {
- seqID func() uint64
- queue []rrt.Message
-}
-
-func newMessageQueue(sedID func() uint64) *messageQueue {
- return &messageQueue{
- seqID: sedID,
- queue: make([]rrt.Message, 0, 5),
- }
-}
-
-func (mq *messageQueue) flush() {
- mq.queue = mq.queue[0:0]
-}
-
-func (mq *messageQueue) allocateMessage(cmd interface{}, payloads *common.Payloads) (uint64, rrt.Message) {
- msg := rrt.Message{
- ID: mq.seqID(),
- Command: cmd,
- Payloads: payloads,
- }
-
- return msg.ID, msg
-}
-
-func (mq *messageQueue) pushCommand(cmd interface{}, payloads *common.Payloads) uint64 {
- id, msg := mq.allocateMessage(cmd, payloads)
- mq.queue = append(mq.queue, msg)
- return id
-}
-
-func (mq *messageQueue) pushResponse(id uint64, payloads *common.Payloads) {
- mq.queue = append(mq.queue, rrt.Message{ID: id, Payloads: payloads})
-}
-
-func (mq *messageQueue) pushError(id uint64, failure *failure.Failure) {
- mq.queue = append(mq.queue, rrt.Message{ID: id, Failure: failure})
-}