Skip to content

Commit

Permalink
[#394]: feature: Replayer API and rr_id
Browse files Browse the repository at this point in the history
  • Loading branch information
rustatian authored Aug 15, 2023
2 parents f6c5224 + b906789 commit 3517136
Show file tree
Hide file tree
Showing 18 changed files with 396 additions and 394 deletions.
11 changes: 11 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

set -e -o pipefail

# https://github.com/koalaman/shellcheck/wiki/SC2039#redirect-both-stdout-and-stderr
if ! command -v golangci-lint 2>&1 /dev/null; then
echo "golangci-lint is not installed"
exit 1
fi

exec golangci-lint --build-tags=race run "$@"
2 changes: 1 addition & 1 deletion .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ jobs:
- name: Run linter
uses: golangci/[email protected] # Action page: <https://github.com/golangci/golangci-lint-action>
with:
version: v1.53 # without patch version
version: v1.54 # without patch version
only-new-issues: false # show only new issues if it's a pull request
args: --timeout=10m --build-tags=safe
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,4 @@ test_coverage:
mkdir ./coverage-ci
go test -v -race -cover -tags=debug -failfast -coverpkg=./... -coverprofile=./coverage-ci/temporal.out -covermode=atomic ./...
echo 'mode: atomic' > ./coverage-ci/summary.txt
tail -q -n +2 ./coverage-ci/*.out >> ./coverage-ci/summary.txt

generate-proto:
protoc -I./proto/api -I./proto --go_out=proto/protocol/v1 ./proto/protocol/v1/protocol.proto
tail -q -n +2 ./coverage-ci/*.out >> ./coverage-ci/summary.txt
1 change: 0 additions & 1 deletion aggregatedpool/activity.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ func (a *Activity) execute(ctx context.Context, args *commonpb.Payloads) (*commo
}

a.running.Delete(utils.AsString(info.TaskToken))

var r *payload.Payload

select {
Expand Down
13 changes: 10 additions & 3 deletions aggregatedpool/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func (wp *Workflow) getContext() *internal.Context {
TickTime: wp.env.Now().Format(time.RFC3339),
Replay: wp.env.IsReplaying(),
HistoryLen: wp.env.WorkflowInfo().GetCurrentHistoryLength(),
RrID: wp.rrID,
}
}

Expand Down Expand Up @@ -57,7 +58,7 @@ func (wp *Workflow) handleSignal(name string, input *commonpb.Payloads, header *
func (wp *Workflow) handleQuery(queryType string, queryArgs *commonpb.Payloads, header *commonpb.Header) (*commonpb.Payloads, error) {
const op = errors.Op("workflow_process_handle_query")
result, err := wp.runCommand(internal.InvokeQuery{
RunID: wp.runID,
RunID: wp.env.WorkflowInfo().WorkflowExecution.RunID,
Name: queryType,
}, queryArgs, header)

Expand Down Expand Up @@ -401,22 +402,25 @@ func (wp *Workflow) flushQueue() error {
// Run single command and return single result.
func (wp *Workflow) runCommand(cmd any, payloads *commonpb.Payloads, header *commonpb.Header) (*internal.Message, error) {
const op = errors.Op("workflow_process_runcommand")
msg := wp.mq.AllocateMessage(cmd, payloads, header)
msg := &internal.Message{}
wp.mq.AllocateMessage(cmd, payloads, header, msg)

if wp.mh != nil {
wp.mh.Gauge(RrMetricName).Update(float64(wp.pool.QueueSize()))
defer wp.mh.Gauge(RrMetricName).Update(float64(wp.pool.QueueSize()))
}

pld := &payload.Payload{}
pld := wp.getPld()
err := wp.codec.Encode(wp.getContext(), pld, msg)
if err != nil {
wp.putPld(pld)
return nil, err
}

// todo(rustatian): do we need a timeout here??
result, err := wp.pool.Exec(context.Background(), pld, nil)
if err != nil {
wp.putPld(pld)
return nil, err
}

Expand All @@ -438,13 +442,16 @@ func (wp *Workflow) runCommand(cmd any, payloads *commonpb.Payloads, header *com
msgs := make([]*internal.Message, 0, 2)
err = wp.codec.Decode(r, &msgs)
if err != nil {
wp.putPld(pld)
return nil, err
}

if len(msgs) != 1 {
wp.putPld(pld)
return nil, errors.E(op, errors.Str("unexpected pool response"))
}

wp.putPld(pld)
return msgs[0], nil
}

Expand Down
9 changes: 6 additions & 3 deletions aggregatedpool/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"sync/atomic"
"time"

"github.com/google/uuid"
"github.com/roadrunner-server/sdk/v4/payload"
"github.com/temporalio/roadrunner-temporal/v4/canceller"
"github.com/temporalio/roadrunner-temporal/v4/common"
Expand Down Expand Up @@ -42,13 +43,13 @@ func seq() uint64 {
type Workflow struct {
codec common.Codec
pool common.Pool
rrID string

env bindings.WorkflowEnvironment
header *commonpb.Header
mq *queue.MessageQueue
ids *registry.IDRegistry
seqID uint64
runID string
pipeline []*internal.Message
callbacks []Callback
canceller *canceller.Canceller
Expand All @@ -61,9 +62,9 @@ type Workflow struct {
pldPool *sync.Pool
}

// RoadRunner function
func NewWorkflowDefinition(codec common.Codec, pool common.Pool, log *zap.Logger) *Workflow {
return &Workflow{
rrID: uuid.NewString(),
log: log,
codec: codec,
pool: pool,
Expand All @@ -79,6 +80,7 @@ func NewWorkflowDefinition(codec common.Codec, pool common.Pool, log *zap.Logger
// DO NOT USE THIS FUNCTION DIRECTLY!!!!
func (wp *Workflow) NewWorkflowDefinition() bindings.WorkflowDefinition {
return &Workflow{
rrID: uuid.NewString(),
pool: wp.pool,
codec: wp.codec,
log: wp.log,
Expand All @@ -98,7 +100,6 @@ func (wp *Workflow) Execute(env bindings.WorkflowEnvironment, header *commonpb.H
wp.env = env
wp.header = header
wp.seqID = 0
wp.runID = env.WorkflowInfo().WorkflowExecution.RunID
wp.canceller = new(canceller.Canceller)

// sequenceID shared for all pool workflows
Expand Down Expand Up @@ -167,13 +168,15 @@ func (wp *Workflow) OnWorkflowTaskStarted(t time.Duration) {

if msg.IsCommand() {
if msg.UndefinedResponse() {
wp.pipeline = nil
panic(fmt.Sprintf("undefined response: %s", msg.Command.(*internal.UndefinedResponse).Message))
}

err = wp.handleMessage(msg)
}

if err != nil {
wp.pipeline = nil
panic(err)
}
}
Expand Down
7 changes: 7 additions & 0 deletions githooks-installer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

set -e

cp ./.githooks/pre-commit .git/hooks/pre-commit

echo "DONE"
26 changes: 14 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
module github.com/temporalio/roadrunner-temporal/v4

go 1.20
go 1.21

toolchain go1.21.0

require (
github.com/cactus/go-statsd-client/statsd v0.0.0-20200423205355-cb0885a1018c
github.com/goccy/go-json v0.10.2
github.com/golang/protobuf v1.5.3
github.com/google/uuid v1.3.0
github.com/roadrunner-server/endure/v2 v2.3.1
github.com/roadrunner-server/errors v1.2.0
github.com/roadrunner-server/sdk/v4 v4.4.0-beta.4
github.com/roadrunner-server/api/v4 v4.6.2
github.com/roadrunner-server/endure/v2 v2.4.1
github.com/roadrunner-server/errors v1.3.0
github.com/roadrunner-server/sdk/v4 v4.4.0-beta.5
github.com/stretchr/testify v1.8.4
github.com/uber-go/tally/v4 v4.1.6
go.temporal.io/api v1.23.0
Expand All @@ -20,8 +22,6 @@ require (
google.golang.org/protobuf v1.31.0
)

require google.golang.org/genproto/googleapis/rpc v0.0.0-20230803162519-f966b187b2e5 // indirect

exclude github.com/uber-go/tally/v4 v4.1.7

require (
Expand All @@ -31,9 +31,10 @@ require (
github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/gogo/googleapis v1.4.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/gogo/protobuf v1.3.2
github.com/gogo/status v1.1.1 // indirect
github.com/golang/mock v1.7.0-rc.1 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/pborman/uuid v1.2.1 // indirect
Expand All @@ -43,12 +44,12 @@ require (
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.1 // indirect
github.com/roadrunner-server/goridge/v3 v3.6.3 // indirect
github.com/roadrunner-server/tcplisten v1.3.0 // indirect
github.com/roadrunner-server/goridge/v3 v3.7.0 // indirect
github.com/roadrunner-server/tcplisten v1.4.0 // indirect
github.com/robfig/cron v1.2.0 // indirect
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/tklauser/go-sysconf v0.3.11 // indirect
github.com/stretchr/objx v0.5.1 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/twmb/murmur3 v1.1.8 // indirect
github.com/yusufpapurcu/wmi v1.2.3 // indirect
Expand All @@ -59,6 +60,7 @@ require (
golang.org/x/sys v0.11.0 // indirect
golang.org/x/text v0.12.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230814215434-ca7cfce7776a // indirect
google.golang.org/grpc v1.57.0
gopkg.in/yaml.v3 v3.0.1 // indirect
)
39 changes: 23 additions & 16 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,7 @@ github.com/apache/arrow/go/v11 v11.0.0/go.mod h1:Eg5OsL5H+e299f7u5ssuXsuHQVEGC4x
github.com/apache/thrift v0.16.0/go.mod h1:PHK3hniurgQaNMZYaCLEqXKsYK8upmhPbmdP2FXSqgU=
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A=
github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
Expand Down Expand Up @@ -843,6 +844,7 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
Expand Down Expand Up @@ -906,23 +908,26 @@ github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1
github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI=
github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY=
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/roadrunner-server/endure/v2 v2.3.1 h1:3ene87OJ/Ct2kyQT7+2VsfNzT+F1oPZbAqkJZFfvy5s=
github.com/roadrunner-server/endure/v2 v2.3.1/go.mod h1:8lhfx3yDm9Jay/KPX0VbmOFnjY4gB4YABoHjSNfY3Ns=
github.com/roadrunner-server/errors v1.2.0 h1:qBmNXt8Iex9QnYTjCkbJKsBZu2EtYkQCM06GUDcQBbI=
github.com/roadrunner-server/errors v1.2.0/go.mod h1:z0ECxZp/dDa5RahtMcy4mBIavVxiZ9vwE5kByl7kFtY=
github.com/roadrunner-server/goridge/v3 v3.6.3 h1:8hCuPVK9BxIE4IGyNphK6KPAy9Kg6t5tHaItBIQKh2o=
github.com/roadrunner-server/goridge/v3 v3.6.3/go.mod h1:hB5+lHhl8msuHrngjKQ+Wx8B705AU0/2DlYGFXbjtgU=
github.com/roadrunner-server/sdk/v4 v4.4.0-beta.4 h1:DtHQBo9xXdN5ru2GAf8tCGnwxLG6lgknzYaDr+c3Fv4=
github.com/roadrunner-server/sdk/v4 v4.4.0-beta.4/go.mod h1:QcZBTccDGT8zhbHkbzqM7SORktVtvh6Jigkz3hy6kBk=
github.com/roadrunner-server/tcplisten v1.3.0 h1:VDd6IbP8oIjm5vKvMVozeZgeHgOcoP0XYLOyOqcZHCY=
github.com/roadrunner-server/tcplisten v1.3.0/go.mod h1:VR6Ob5am0oEuLMOeLiVvQxG9ShykAEgrlvZddX8EfoU=
github.com/roadrunner-server/api/v4 v4.6.2 h1:BsbVb7Y0Dsz1/6GMja/yVcOAbozHbYQ3i24DTLh7geI=
github.com/roadrunner-server/api/v4 v4.6.2/go.mod h1:7RPouCwEAZSfWKU5eAf5Bc6snFw97RvfWk1Mz+kaKLQ=
github.com/roadrunner-server/endure/v2 v2.4.1 h1:ukwAoMQoUqPsD4Fu4wCeG84FfN/dGqy2a1F9ufl4vH8=
github.com/roadrunner-server/endure/v2 v2.4.1/go.mod h1:uBmTMeZYtKTT8+aa2Ge/FH95G/VACj0QpZ8yf36wn6Y=
github.com/roadrunner-server/errors v1.3.0 h1:kLVXpXne0jMReN7pj8KIhyYyjqKjsPC5DRGqMsd4/Fo=
github.com/roadrunner-server/errors v1.3.0/go.mod h1:XYVuhXvxi3yQaP/zCLB6QRZ0JvQIRaBa0SKFHL4WLKg=
github.com/roadrunner-server/goridge/v3 v3.7.0 h1:+Z8pezA4vvZ+/LpF7tjmwOYHa9jKrjbGtBn7RpRAswI=
github.com/roadrunner-server/goridge/v3 v3.7.0/go.mod h1:xgheswRjWvQBHRf3AEkFgLnYOSzYg13ZH0OCuDIcJpg=
github.com/roadrunner-server/sdk/v4 v4.4.0-beta.5 h1:+CmSTbz+y51auBr48ldwx6ZgAnWKl7f3537xyW8GDsU=
github.com/roadrunner-server/sdk/v4 v4.4.0-beta.5/go.mod h1:UkiAk5IdmUzkXncfy671OoH6i/zWpWc+JY3IU/AnQuc=
github.com/roadrunner-server/tcplisten v1.4.0 h1:yWo09zktv/CSV6VywLfw4pwNcUchgTiIrW4uIICtO5M=
github.com/roadrunner-server/tcplisten v1.4.0/go.mod h1:A6+VSnW2ETGnN/e/CMdP63ZXqQDaC0UDMU6QmyuB0yM=
github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ=
github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w=
github.com/ruudk/golang-pdf417 v0.0.0-20201230142125-a7e3863a1245/go.mod h1:pQAZKsJ8yyVxGRWYNEm9oFB8ieLgKFnamEyDmSA0BRk=
github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI=
Expand All @@ -938,8 +943,9 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.3.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/objx v0.5.1 h1:4VhoImhV/Bm0ToFkXFi8hXNXwpDRZ/ynw3amt82mzq0=
github.com/stretchr/objx v0.5.1/go.mod h1:/iHQpkQwBD6DLUmQ4pE+s1TXdob1mORJ4/UFdrifcy0=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
Expand All @@ -949,12 +955,12 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/tklauser/go-sysconf v0.3.11 h1:89WgdJhk5SNwJfu+GKyYveZ4IaJ7xAkecBo+KdJV0CM=
github.com/tklauser/go-sysconf v0.3.11/go.mod h1:GqXfhXY3kiPa0nAXPDIQIWzJbMCB7AmcWpGR8lSZfqI=
github.com/tklauser/numcpus v0.6.0/go.mod h1:FEZLMke0lhOUG6w2JadTzp0a+Nl8PF/GFkQ5UVIcaL4=
github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU=
github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI=
github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk=
github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY=
github.com/twmb/murmur3 v1.1.5/go.mod h1:Qq/R7NUyOfr65zD+6Q5IHKsJLwP7exErjN6lyyq3OSQ=
Expand Down Expand Up @@ -1003,6 +1009,7 @@ go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk=
go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
Expand Down Expand Up @@ -1593,8 +1600,8 @@ google.golang.org/genproto v0.0.0-20230525234025-438c736192d0/go.mod h1:9ExIQyXL
google.golang.org/genproto/googleapis/api v0.0.0-20230525234020-1aefcd67740a/go.mod h1:ts19tUU+Z0ZShN1y3aPyq2+O3d5FUNNgT6FtOzmrNn8=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234015-3fc162c6f38a/go.mod h1:xURIpW9ES5+/GZhnV6beoEtxQrnkRGIfP5VQG2tCBLc=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230803162519-f966b187b2e5 h1:eSaPbMR4T7WfH9FvABk36NBMacoTUKdWCvV0dx+KfOg=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230803162519-f966b187b2e5/go.mod h1:zBEcrKX2ZOcEkHWxBPAIvYUWOKKMIhYcmNiUIu2ji3I=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230814215434-ca7cfce7776a h1:5rTPHLf5eLPfqGvw3fLpEmUpko2Ky91ft14LxGs5BZc=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230814215434-ca7cfce7776a/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M=
google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
Expand Down
3 changes: 2 additions & 1 deletion internal/codec/proto/proto.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"sync"

"github.com/goccy/go-json"
protocolV1 "github.com/roadrunner-server/api/v4/build/temporal/v1"
"github.com/roadrunner-server/errors"
"github.com/roadrunner-server/sdk/v4/payload"
"github.com/temporalio/roadrunner-temporal/v4/internal"
protocolV1 "github.com/temporalio/roadrunner-temporal/v4/proto/protocol/v1"
"go.temporal.io/sdk/converter"
"go.uber.org/zap"
"google.golang.org/protobuf/proto"
Expand Down Expand Up @@ -145,6 +145,7 @@ func (c *Codec) packMessage(msg *internal.Message, ctx *internal.Context, protoM
protoMsg.Failure = msg.Failure
protoMsg.Header = msg.Header
protoMsg.HistoryLength = int64(ctx.HistoryLen)
protoMsg.RunId = ctx.RrID

if msg.Command != nil {
protoMsg.Command, err = internal.CommandName(msg.Command)
Expand Down
11 changes: 11 additions & 0 deletions internal/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ type Context struct {
Replay bool `json:"replay,omitempty"`
// History
HistoryLen int `json:"history_length,omitempty"`
// RoadRunner run ID
RrID string `json:"rr_id"`
}

// Message used to exchange the send commands and receive responses from underlying workers.
Expand Down Expand Up @@ -149,6 +151,15 @@ type InvokeQuery struct {
Name string `json:"name"`
}

type InvokeUpdate struct {
// UpdateID is Workflow update ID
UpdateID string `json:"updateId"`
// RunID workflow run id.
RunID string `json:"runId"`
// Name of the query.
Name string `json:"name"`
}

// CancelWorkflow asks worker to gracefully stop workflow, if possible (signal).
type CancelWorkflow struct {
// RunID workflow run id.
Expand Down
Loading

0 comments on commit 3517136

Please sign in to comment.