Skip to content

Commit d720b1e

Browse files
committed
add new field mapping to historySize from pollFromDecisionTask
1 parent c0f5bb0 commit d720b1e

File tree

7 files changed

+74
-6
lines changed

7 files changed

+74
-6
lines changed

.gen/go/shared/shared.go

Lines changed: 48 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,5 @@ require (
6666
gopkg.in/yaml.v3 v3.0.1 // indirect
6767
honnef.co/go/tools v0.3.2 // indirect
6868
)
69+
70+
replace github.com/uber/cadence-idl => github.com/timl3136/cadence-idl v0.0.0-20230811235258-a2fc7af34b3e

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
194194
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
195195
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
196196
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
197+
github.com/timl3136/cadence-idl v0.0.0-20230811235258-a2fc7af34b3e h1:3E7jeCTrIErCi7XI1rSpxjSBUoyphW8ssLq7k7whTpY=
198+
github.com/timl3136/cadence-idl v0.0.0-20230811235258-a2fc7af34b3e/go.mod h1:oyUK7GCNCRHCCyWyzifSzXpVrRYVBbAMHAzF5dXiKws=
197199
github.com/tklauser/go-sysconf v0.3.11 h1:89WgdJhk5SNwJfu+GKyYveZ4IaJ7xAkecBo+KdJV0CM=
198200
github.com/tklauser/go-sysconf v0.3.11/go.mod h1:GqXfhXY3kiPa0nAXPDIQIWzJbMCB7AmcWpGR8lSZfqI=
199201
github.com/tklauser/numcpus v0.6.0 h1:kebhY2Qt+3U6RNK7UqpYNA+tJ23IBEGKkB7JQBfDYms=
@@ -204,8 +206,6 @@ github.com/uber-go/mapdecode v1.0.0/go.mod h1:b5nP15FwXTgpjTjeA9A2uTHXV5UJCl4arw
204206
github.com/uber-go/tally v3.3.12+incompatible/go.mod h1:YDTIBxdXyOU/sCWilKB4bgyufu1cEi0jdVnRdxvjnmU=
205207
github.com/uber-go/tally v3.3.15+incompatible h1:9hLSgNBP28CjIaDmAuRTq9qV+UZY+9PcvAkXO4nNMwg=
206208
github.com/uber-go/tally v3.3.15+incompatible/go.mod h1:YDTIBxdXyOU/sCWilKB4bgyufu1cEi0jdVnRdxvjnmU=
207-
github.com/uber/cadence-idl v0.0.0-20230131090243-b690237fffaa h1:hL0lacJisx3N7az86s2Mg8J67R+d7arO3ykiExzMsTA=
208-
github.com/uber/cadence-idl v0.0.0-20230131090243-b690237fffaa/go.mod h1:oyUK7GCNCRHCCyWyzifSzXpVrRYVBbAMHAzF5dXiKws=
209209
github.com/uber/jaeger-client-go v2.22.1+incompatible h1:NHcubEkVbahf9t3p75TOCR83gdUHXjRJvjoBh1yACsM=
210210
github.com/uber/jaeger-client-go v2.22.1+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk=
211211
github.com/uber/jaeger-lib v2.2.0+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U=

internal/compatibility/proto/response.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ func PollForDecisionTaskResponse(t *shared.PollForDecisionTaskResponse) *apiv1.P
223223
StartedTime: unixNanoToTime(t.StartedTimestamp),
224224
Queries: WorkflowQueryMap(t.Queries),
225225
NextEventId: t.GetNextEventId(),
226+
HistorySize: t.GetHistorySize(),
226227
}
227228
}
228229

internal/compatibility/thrift/response.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ func PollForDecisionTaskResponse(t *apiv1.PollForDecisionTaskResponse) *shared.P
223223
StartedTimestamp: timeToUnixNano(t.StartedTime),
224224
Queries: WorkflowQueryMap(t.Queries),
225225
NextEventId: &t.NextEventId,
226+
HistorySize: &t.HistorySize,
226227
}
227228
}
228229

internal/workflow.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,6 +1158,16 @@ func (wc *workflowEnvironmentInterceptor) GetMetricsScope(ctx Context) tally.Sco
11581158
return wc.env.GetMetricsScope()
11591159
}
11601160

1161+
// GetHistorySize returns the current history size of that workflow
1162+
func GetHistorySize(ctx Context) int64 {
1163+
return 0
1164+
}
1165+
1166+
// GetHistoryCount returns the current number of events of that workflow
1167+
func GetHistoryCount(ctx Context) int64 {
1168+
return 0
1169+
}
1170+
11611171
// Now returns the current time in UTC. It corresponds to the time when the decision task is started or replayed.
11621172
// Workflow needs to use this method to get the wall clock time instead of the one from the golang library.
11631173
func Now(ctx Context) time.Time {

workflow/workflow.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,16 @@ func GetMetricsScope(ctx Context) tally.Scope {
217217
return internal.GetMetricsScope(ctx)
218218
}
219219

220+
// GetHistorySize returns the current history size of that workflow
221+
func GetHistorySize(ctx Context) int64 {
222+
return internal.GetHistorySize(ctx)
223+
}
224+
225+
// GetHistoryCount returns the current number of history event of that workflow
226+
func GetHistoryCount(ctx Context) int64 {
227+
return internal.GetHistoryCount(ctx)
228+
}
229+
220230
// RequestCancelExternalWorkflow can be used to request cancellation of an external workflow.
221231
// Input workflowID is the workflow ID of target workflow.
222232
// Input runID indicates the instance of a workflow. Input runID is optional (default is ""). When runID is not specified,

0 commit comments

Comments
 (0)