11package scheduler
22
3- import "go.temporal.io/server/chasm"
3+ import (
4+ "go.temporal.io/server/chasm"
5+ "go.uber.org/fx"
6+ )
47
58type (
6- library struct {
9+ Library struct {
10+ fx.In
11+
712 chasm.UnimplementedLibrary
813
9- schedulerIdleTaskExecutor * SchedulerIdleTaskExecutor
10- generatorTaskExecutor * GeneratorTaskExecutor
11- invokerExecuteTaskExecutor * InvokerExecuteTaskExecutor
12- invokerProcessBufferTaskExecutor * InvokerProcessBufferTaskExecutor
13- backfillerTaskExecutor * BackfillerTaskExecutor
14+ SchedulerIdleTaskExecutor * SchedulerIdleTaskExecutor
15+ GeneratorTaskExecutor * GeneratorTaskExecutor
16+ InvokerExecuteTaskExecutor * InvokerExecuteTaskExecutor
17+ InvokerProcessBufferTaskExecutor * InvokerProcessBufferTaskExecutor
18+ BackfillerTaskExecutor * BackfillerTaskExecutor
1419 }
1520)
1621
17- var Library = & library {}
18-
19- func (l * library ) SetSchedulerIdleTaskExecutor (executor * SchedulerIdleTaskExecutor ) {
20- l .schedulerIdleTaskExecutor = executor
21- }
22-
23- func (l * library ) SetGeneratorTaskExecutor (executor * GeneratorTaskExecutor ) {
24- l .generatorTaskExecutor = executor
25- }
26-
27- func (l * library ) SetInvokerExecuteTaskExecutor (executor * InvokerExecuteTaskExecutor ) {
28- l .invokerExecuteTaskExecutor = executor
29- }
30-
31- func (l * library ) SetInvokerProcessBufferTaskExecutor (executor * InvokerProcessBufferTaskExecutor ) {
32- l .invokerProcessBufferTaskExecutor = executor
33- }
34-
35- func (l * library ) SetBackfillerTaskExecutor (executor * BackfillerTaskExecutor ) {
36- l .backfillerTaskExecutor = executor
22+ func NewLibrary (
23+ SchedulerIdleTaskExecutor * SchedulerIdleTaskExecutor ,
24+ GeneratorTaskExecutor * GeneratorTaskExecutor ,
25+ InvokerExecuteTaskExecutor * InvokerExecuteTaskExecutor ,
26+ InvokerProcessBufferTaskExecutor * InvokerProcessBufferTaskExecutor ,
27+ BackfillerTaskExecutor * BackfillerTaskExecutor ,
28+ ) * Library {
29+ return & Library {
30+ SchedulerIdleTaskExecutor : SchedulerIdleTaskExecutor ,
31+ GeneratorTaskExecutor : GeneratorTaskExecutor ,
32+ InvokerExecuteTaskExecutor : InvokerExecuteTaskExecutor ,
33+ InvokerProcessBufferTaskExecutor : InvokerProcessBufferTaskExecutor ,
34+ BackfillerTaskExecutor : BackfillerTaskExecutor ,
35+ }
3736}
3837
39- func (l * library ) Name () string {
38+ func (l * Library ) Name () string {
4039 return "scheduler"
4140}
4241
43- func (l * library ) Components () []* chasm.RegistrableComponent {
42+ func (l * Library ) Components () []* chasm.RegistrableComponent {
4443 return []* chasm.RegistrableComponent {
4544 chasm.NewRegistrableComponent [* Scheduler ]("scheduler" ),
4645 chasm.NewRegistrableComponent [* Generator ]("generator" ),
@@ -49,32 +48,32 @@ func (l *library) Components() []*chasm.RegistrableComponent {
4948 }
5049}
5150
52- func (l * library ) Tasks () []* chasm.RegistrableTask {
51+ func (l * Library ) Tasks () []* chasm.RegistrableTask {
5352 return []* chasm.RegistrableTask {
5453 chasm .NewRegistrablePureTask (
5554 "idle" ,
56- l .schedulerIdleTaskExecutor ,
57- l .schedulerIdleTaskExecutor ,
55+ l .SchedulerIdleTaskExecutor ,
56+ l .SchedulerIdleTaskExecutor ,
5857 ),
5958 chasm .NewRegistrablePureTask (
6059 "generate" ,
61- l .generatorTaskExecutor ,
62- l .generatorTaskExecutor ,
60+ l .GeneratorTaskExecutor ,
61+ l .GeneratorTaskExecutor ,
6362 ),
6463 chasm .NewRegistrableSideEffectTask (
6564 "execute" ,
66- l .invokerExecuteTaskExecutor ,
67- l .invokerExecuteTaskExecutor ,
65+ l .InvokerExecuteTaskExecutor ,
66+ l .InvokerExecuteTaskExecutor ,
6867 ),
6968 chasm .NewRegistrablePureTask (
7069 "processBuffer" ,
71- l .invokerProcessBufferTaskExecutor ,
72- l .invokerProcessBufferTaskExecutor ,
70+ l .InvokerProcessBufferTaskExecutor ,
71+ l .InvokerProcessBufferTaskExecutor ,
7372 ),
7473 chasm .NewRegistrablePureTask (
7574 "backfill" ,
76- l .backfillerTaskExecutor ,
77- l .backfillerTaskExecutor ,
75+ l .BackfillerTaskExecutor ,
76+ l .BackfillerTaskExecutor ,
7877 ),
7978 }
8079}
0 commit comments