Skip to content

Commit f17cd94

Browse files
committed
fix: update state consumers for the renamed APIs
Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
1 parent e38e2eb commit f17cd94

5 files changed

Lines changed: 12 additions & 12 deletions

File tree

durable/actor_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func supervisorMachine() *state.Machine[string, string, actorCtx] {
6868
return c
6969
}).
7070
Actor("spawnChild").
71-
State("supervising").InvokeActor("spawnChild", "childDone", "childFail").
71+
State("supervising").InvokeActor("spawnChild", state.WithInvokeOnDone("childDone"), state.WithInvokeOnError("childFail")).
7272
State("complete").Final().
7373
State("failed").Final().
7474
Initial("supervising").
@@ -256,7 +256,7 @@ func messengerMachine() *state.Machine[string, string, actorCtx] {
256256
return c
257257
}).
258258
Actor("spawnPinger").
259-
State("listening").InvokeActor("spawnPinger", "pingerDone", "pingerFail").
259+
State("listening").InvokeActor("spawnPinger", state.WithInvokeOnDone("pingerDone"), state.WithInvokeOnError("pingerFail")).
260260
State("heard").
261261
State("failed").Final().
262262
Initial("listening").
@@ -334,8 +334,8 @@ func twoActorMachine() *state.Machine[string, string, actorCtx] {
334334
}).
335335
Actor("childA").
336336
Actor("childB").
337-
State("first").InvokeActor("childA", "aDone", "aFail").
338-
State("second").InvokeActor("childB", "bDone", "bFail").
337+
State("first").InvokeActor("childA", state.WithInvokeOnDone("aDone"), state.WithInvokeOnError("aFail")).
338+
State("second").InvokeActor("childB", state.WithInvokeOnDone("bDone"), state.WithInvokeOnError("bFail")).
339339
State("done").Final().
340340
State("failed").Final().
341341
Initial("first").

durable/integration_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ func pipelineMachine() *state.Machine[string, string, *pipelineCtx] {
178178
return nil, nil
179179
}).
180180
State("idle").
181-
State("fetching").Invoke("load", "loaded", "loadFail").
182-
State("spawning").InvokeActor("worker", "workerDone", "workerFail").
181+
State("fetching").Invoke("load", state.WithInvokeOnDone("loaded"), state.WithInvokeOnError("loadFail")).
182+
State("spawning").InvokeActor("worker", state.WithInvokeOnDone("workerDone"), state.WithInvokeOnError("workerFail")).
183183
State("ready").
184184
State("notifying").
185185
State("done").Final().

durable/runner_example_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func quoteMachine(fn state.ServiceFn[*quoteCtx]) *state.Machine[string, string,
148148
return c
149149
}).
150150
State("cart").
151-
State("quoting").Invoke("price", "priced", "failed").
151+
State("quoting").Invoke("price", state.WithInvokeOnDone("priced"), state.WithInvokeOnError("failed")).
152152
State("quoted").Final().
153153
State("rejected").Final().
154154
Initial("cart").
@@ -222,7 +222,7 @@ func fulfillmentMachine() *state.Machine[string, string, *fulfillmentCtx] {
222222
return c
223223
}).
224224
Actor("ship").
225-
State("supervising").InvokeActor("ship", "shipped", "failed").
225+
State("supervising").InvokeActor("ship", state.WithInvokeOnDone("shipped"), state.WithInvokeOnError("failed")).
226226
State("complete").Final().
227227
State("aborted").Final().
228228
Initial("supervising").

durable/service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func (h *Handle[S, E, C]) RunService(ctx context.Context, id string) (state.Fire
9595
return state.FireResult[S]{}, false, nil
9696
}
9797

98-
res, ok := h.svc.Run(ctx, id)
98+
res, ok := h.svc.Tick(ctx, id)
9999
if !ok {
100100
return state.FireResult[S]{}, false, nil
101101
}

durable/service_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func fetchMachine(fn state.ServiceFn[svcCtx]) *state.Machine[string, string, svc
6565
return c
6666
}).
6767
State("idle").
68-
State("loading").Invoke("fetch", "ok", "fail").
68+
State("loading").Invoke("fetch", state.WithInvokeOnDone("ok"), state.WithInvokeOnError("fail")).
6969
State("ready").Final().
7070
State("errored").Final().
7171
Initial("idle").
@@ -228,8 +228,8 @@ func chainMachine(svcA, svcB state.ServiceFn[svcCtx]) *state.Machine[string, str
228228
return c
229229
}).
230230
State("idle").
231-
State("first").Invoke("svcA", "aDone", "aFail").
232-
State("second").Invoke("svcB", "bDone", "bFail").
231+
State("first").Invoke("svcA", state.WithInvokeOnDone("aDone"), state.WithInvokeOnError("aFail")).
232+
State("second").Invoke("svcB", state.WithInvokeOnDone("bDone"), state.WithInvokeOnError("bFail")).
233233
State("done").Final().
234234
State("failed").Final().
235235
Initial("idle").

0 commit comments

Comments
 (0)