Files
tasks/chasm/lib/nexusoperation/cancellation_statemachine.go
zeekay 5a601d081b rebrand: go.temporal.io/server -> github.com/hanzoai/tasks
Full module path rebrand from Temporal to Hanzo Tasks:
- go.mod module: github.com/hanzoai/tasks
- All internal Go imports updated (1906 files)
- cmd/server renamed to cmd/tasksd
- Binary name: tasksd (was temporal-server)
- Docker images: hanzoai/tasks (was temporalio/server)
- README rewritten with Hanzo Tasks branding
- LLM.md created with integration notes
- Makefile, goreleaser, CI workflows updated
- go.temporal.io/sdk and go.temporal.io/api imports preserved (separate repos)

Fork of Temporal.io (MIT license).
2026-03-19 10:36:40 -07:00

75 lines
2.9 KiB
Go

package nexusoperation
import (
"go.temporal.io/api/serviceerror"
"github.com/hanzoai/tasks/chasm"
"github.com/hanzoai/tasks/chasm/lib/nexusoperation/gen/nexusoperationpb/v1"
)
// EventCancellationScheduled is triggered when cancellation is meant to be scheduled for the first time - immediately
// after it has been requested.
type EventCancellationScheduled struct {
}
var transitionCancellationScheduled = chasm.NewTransition(
[]nexusoperationpb.CancellationStatus{nexusoperationpb.CANCELLATION_STATUS_UNSPECIFIED},
nexusoperationpb.CANCELLATION_STATUS_SCHEDULED,
func(c *Cancellation, ctx chasm.MutableContext, event EventCancellationScheduled) error {
return serviceerror.NewUnimplemented("unimplemented")
},
)
// EventCancellationRescheduled is triggered when cancellation is meant to be rescheduled after backing off from a
// previous attempt.
type EventCancellationRescheduled struct {
}
var transitionCancellationRescheduled = chasm.NewTransition(
[]nexusoperationpb.CancellationStatus{nexusoperationpb.CANCELLATION_STATUS_BACKING_OFF},
nexusoperationpb.CANCELLATION_STATUS_SCHEDULED,
func(c *Cancellation, ctx chasm.MutableContext, event EventCancellationRescheduled) error {
return serviceerror.NewUnimplemented("unimplemented")
},
)
// EventCancellationAttemptFailed is triggered when a cancellation attempt is failed with a retryable error.
type EventCancellationAttemptFailed struct {
}
var transitionCancellationAttemptFailed = chasm.NewTransition(
[]nexusoperationpb.CancellationStatus{nexusoperationpb.CANCELLATION_STATUS_SCHEDULED},
nexusoperationpb.CANCELLATION_STATUS_BACKING_OFF,
func(c *Cancellation, ctx chasm.MutableContext, event EventCancellationAttemptFailed) error {
return serviceerror.NewUnimplemented("unimplemented")
},
)
// EventCancellationFailed is triggered when a cancellation attempt is failed with a non retryable error.
type EventCancellationFailed struct {
}
var transitionCancellationFailed = chasm.NewTransition(
[]nexusoperationpb.CancellationStatus{
// We can immediately transition to failed to since we don't know how to send a cancellation request for an
// unstarted operation.
nexusoperationpb.CANCELLATION_STATUS_UNSPECIFIED,
nexusoperationpb.CANCELLATION_STATUS_SCHEDULED,
},
nexusoperationpb.CANCELLATION_STATUS_FAILED,
func(c *Cancellation, ctx chasm.MutableContext, event EventCancellationFailed) error {
return serviceerror.NewUnimplemented("unimplemented")
},
)
// EventCancellationSucceeded is triggered when a cancellation attempt succeeds.
type EventCancellationSucceeded struct {
}
var transitionCancellationSucceeded = chasm.NewTransition(
[]nexusoperationpb.CancellationStatus{nexusoperationpb.CANCELLATION_STATUS_SCHEDULED},
nexusoperationpb.CANCELLATION_STATUS_SUCCEEDED,
func(c *Cancellation, ctx chasm.MutableContext, event EventCancellationSucceeded) error {
return serviceerror.NewUnimplemented("unimplemented")
},
)