Skip to content

Commit 038051a

Browse files
authored
CHASM: Workflow library (#8554)
## What changed? - Wire up chasm workflow library ## Why? - #8485 makes workflow start to use CHASM as well and we need to register workflow as a chasm library. ## How did you test it? - [x] built - [ ] run locally and tested manually - [ ] covered by existing tests - [ ] added new unit test(s) - [ ] added new functional test(s) ## Potential risks - Logic is only used when chasm feature flag is turned on. The change is mainly for functional tests.
1 parent 651d959 commit 038051a

File tree

4 files changed

+40
-1
lines changed

4 files changed

+40
-1
lines changed

chasm/lib/workflow/fx.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package workflow
2+
3+
import (
4+
"go.temporal.io/server/chasm"
5+
"go.uber.org/fx"
6+
)
7+
8+
var Module = fx.Module(
9+
"chasm.lib.workflow",
10+
fx.Provide(NewLibrary),
11+
fx.Invoke(func(registry *chasm.Registry, library *Library) error {
12+
return registry.Register(library)
13+
}),
14+
)

chasm/lib/workflow/library.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package workflow
2+
3+
import "go.temporal.io/server/chasm"
4+
5+
type (
6+
Library struct {
7+
chasm.UnimplementedLibrary
8+
}
9+
)
10+
11+
func NewLibrary() *Library {
12+
return &Library{}
13+
}
14+
15+
func (l *Library) Name() string {
16+
return "workflow"
17+
}
18+
19+
func (l *Library) Components() []*chasm.RegistrableComponent {
20+
return []*chasm.RegistrableComponent{
21+
chasm.NewRegistrableComponent[*Workflow]("Workflow"),
22+
}
23+
}

chasm/lib/workflow/workflow.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
const (
99
// Archetype for today's workflow implementation.
1010
// This value is NOT persisted today, and ok to be changed.
11-
Archetype chasm.Archetype = "Workflow"
11+
Archetype chasm.Archetype = "workflow.Workflow"
1212
)
1313

1414
type Workflow struct {

service/history/fx.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"go.temporal.io/server/api/historyservice/v1"
55
"go.temporal.io/server/chasm"
66
chasmscheduler "go.temporal.io/server/chasm/lib/scheduler"
7+
chasmworkflow "go.temporal.io/server/chasm/lib/workflow"
78
"go.temporal.io/server/common"
89
"go.temporal.io/server/common/clock"
910
"go.temporal.io/server/common/config"
@@ -81,6 +82,7 @@ var Module = fx.Options(
8182
nexusoperations.Module,
8283
fx.Invoke(nexusworkflow.RegisterCommandHandlers),
8384
chasmscheduler.Module,
85+
chasmworkflow.Module,
8486
)
8587

8688
func ServerProvider(grpcServerOptions []grpc.ServerOption) *grpc.Server {

0 commit comments

Comments
 (0)