mirror of
https://github.com/hanzoai/tasks.git
synced 2026-11-03 03:56:04 +00:00
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).
50 lines
1.8 KiB
Go
50 lines
1.8 KiB
Go
package update
|
|
|
|
import (
|
|
"context"
|
|
|
|
historypb "go.temporal.io/api/history/v1"
|
|
updatepb "go.temporal.io/api/update/v1"
|
|
persistencespb "github.com/hanzoai/tasks/api/persistence/v1"
|
|
"github.com/hanzoai/tasks/common/effect"
|
|
)
|
|
|
|
type (
|
|
// UpdateStore represents the update package's requirements for reading Updates from the store.
|
|
UpdateStore interface {
|
|
VisitUpdates(visitor func(updID string, updInfo *persistencespb.UpdateInfo))
|
|
GetUpdateOutcome(ctx context.Context, updateID string) (*updatepb.Outcome, error)
|
|
GetCurrentVersion() int64
|
|
IsWorkflowExecutionRunning() bool
|
|
}
|
|
|
|
// EventStore is the interface that an Update needs to read and write events
|
|
// and to be notified when buffered writes have been flushed. It is the
|
|
// expectation of this code that writes to EventStore will return before the
|
|
// data has been made durable. Callbacks attached to the EventStore via
|
|
// OnAfterCommit and OnAfterRollback *must* be called after the EventStore
|
|
// state is successfully written or is discarded.
|
|
EventStore interface {
|
|
effect.Controller
|
|
|
|
// AddWorkflowExecutionUpdateAcceptedEvent writes an Update accepted
|
|
// event. The data may not be durable when this function returns.
|
|
AddWorkflowExecutionUpdateAcceptedEvent(
|
|
updateID string,
|
|
acceptedRequestMessageId string,
|
|
acceptedRequestSequencingEventId int64,
|
|
acceptedRequest *updatepb.Request,
|
|
) (*historypb.HistoryEvent, error)
|
|
|
|
// AddWorkflowExecutionUpdateCompletedEvent writes an Update completed
|
|
// event. The data may not be durable when this function returns.
|
|
AddWorkflowExecutionUpdateCompletedEvent(
|
|
acceptedEventID int64,
|
|
resp *updatepb.Response,
|
|
) (*historypb.HistoryEvent, error)
|
|
|
|
// CanAddEvent returns true if an event can be added to the EventStore.
|
|
CanAddEvent() bool
|
|
}
|
|
)
|