@@ -32,9 +32,9 @@ import (
3232
3333func main () {
3434 g := NewGraph[string , string ]()
35- err := g.AddLambdaNode (" node1" , compose.InvokableLambda (func (ctx ** context** ._Context_ , input string ) (output string , err error ) {/* invokable func*/ })
35+ err := g.AddLambdaNode (" node1" , compose.InvokableLambda (func (ctx context._Context_ , input string ) (output string , err error ) {/* invokable func*/ })
3636 if err != nil {/* error handle */ }
37- err = g.AddLambdaNode (" node2" , compose.InvokableLambda (func (ctx ** context** ._Context_ , input string ) (output string , err error ) {/* invokable func*/ })
37+ err = g.AddLambdaNode (" node2" , compose.InvokableLambda (func (ctx context._Context_ , input string ) (output string , err error ) {/* invokable func*/ })
3838 if err != nil {/* error handle */ }
3939
4040 /* * other graph composed code
@@ -54,13 +54,13 @@ func main() {
5454``` go
5555// compose/checkpoint.go
5656
57- ** type ** InterruptInfo ** struct ** {
57+ type InterruptInfo struct {
5858 State any
5959 BeforeNodes []string
6060 AfterNodes []string
6161 RerunNodes []string
62- RerunNodesExtra ** map ** [string ]any
63- SubGraphs ** map ** [string ]*InterruptInfo
62+ RerunNodesExtra map [string ]any
63+ SubGraphs map [string ]*InterruptInfo
6464 InterruptContexts []*InterruptCtx
6565}
6666
@@ -102,8 +102,8 @@ CheckPointStore 是一个 key 类型为 string、value 类型为[]byte 的 KV
102102// compose/checkpoint.go
103103
104104type CheckpointStore interface {
105- Get (ctx ** context** ._Context_ , key string ) (value []byte , existed bool ,err error )
106- Set (ctx ** context** ._Context_ , key string , value []byte ) (err error )
105+ Get (ctx context._Context_ , key string ) (value []byte , existed bool ,err error )
106+ Set (ctx context._Context_ , key string , value []byte ) (err error )
107107}
108108```
109109
@@ -206,7 +206,7 @@ Checkpoint id 会被作为 CheckPointStore 的 key 使用,graph 运行时会
206206var InterruptAndRerun = errors.New("interrupt and rerun")
207207
208208// emit an interrupt signal with extra info
209- ** func ** NewInterruptAndRerunErr(extra any) error
209+ func NewInterruptAndRerunErr(extra any) error
210210```
211211
212212Eino Graph 接收到节点返回此错误后会发生 interrupt,恢复运行时,会再次运行此节点,再次运行前会调用 StateModifier 修改 state(如果已配置)。
@@ -245,7 +245,7 @@ func CompositeInterrupt(ctx context.Context, info any, state any, errs ...error)
245245_// WithGraphInterrupt creates a context with graph cancellation support._
246246_// When the returned context is used to invoke a graph or workflow, calling the interrupt function will trigger an interrupt._
247247_// The graph will wait for current tasks to complete by default._
248- ** func ** WithGraphInterrupt (parent context.Context ) (ctx context.Context , interrupt ** func ** (opts ...GraphInterruptOption )) {}
248+ func WithGraphInterrupt (parent context .Context ) (ctx context .Context , interrupt func (opts ...GraphInterruptOption)) {}
249249```
250250
251251在主动调用 interrupt function 时,可以传递超时等参数:
@@ -255,8 +255,8 @@ _// The graph will wait for current tasks to complete by default._
255255
256256_// WithGraphInterruptTimeout specifies the max waiting time before generating an interrupt._
257257_// After the max waiting time, the graph will force an interrupt. Any unfinished tasks will be re-run when the graph is resumed._
258- ** func ** WithGraphInterruptTimeout (timeout time.Duration ) GraphInterruptOption {
259- ** return func ** (o *graphInterruptOptions) {
258+ func WithGraphInterruptTimeout (timeout time .Duration ) GraphInterruptOption {
259+ return func (o *graphInterruptOptions) {
260260 o.timeout = &timeout
261261 }
262262}
0 commit comments