Files
tasks/chasm/task.go
b98f0e2474 [CHASM] Pass TaskAttributes to Executors and Validators (#7938)
## What changed?
- TaskAttributes is now passed to all CHASM executors and validators. I
decided against introducing a struct for task arguments because it's
likely that any additional bits we'd pass along to handlers would go in
`TaskAttributes`, and not some outer container (`taskWithAttributes`),
and I'd like handlers that don't need attributes to be able to simply
`_` them out.

## How did you test it?
- [ ] built
- [ ] run locally and tested manually
- [x] covered by existing tests
- [] added new unit test(s)
- [ ] added new functional test(s)

---------

Co-authored-by: Stephan Behnke <[email protected]>
2025-06-18 21:26:59 +00:00

30 lines
586 B
Go

//go:generate mockgen -package $GOPACKAGE -source $GOFILE -destination task_mock.go
package chasm
import (
"context"
"time"
)
type (
TaskAttributes struct {
ScheduledTime time.Time
Destination string
}
SideEffectTaskExecutor[C any, T any] interface {
Execute(context.Context, ComponentRef, TaskAttributes, T) error
}
PureTaskExecutor[C any, T any] interface {
Execute(MutableContext, C, TaskAttributes, T) error
}
TaskValidator[C any, T any] interface {
Validate(Context, C, TaskAttributes, T) (bool, error)
}
)
var TaskScheduledTimeImmediate = time.Time{}