Documentation
¶
Overview ¶
Package kernel is the pure in-memory history/command/replay engine for workflow-as-code. It has no I/O and no driver dependency: persistence and workers sit above it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct {
Type CommandType
Payload json.RawMessage
}
Command is emitted by the workflow function during replay when it reaches a point that needs a new durable effect.
type CommandType ¶
type CommandType string
Command is a side-effect request produced by replay when history is exhausted for a given workflow decision point.
const ( CommandScheduleOperation CommandType = "ScheduleOperation" CommandStartTimer CommandType = "StartTimer" CommandCompleteWorkflow CommandType = "CompleteWorkflow" CommandFailWorkflow CommandType = "FailWorkflow" CommandSuspendWorkflow CommandType = "SuspendWorkflow" )
type Cursor ¶
type Cursor struct {
// contains filtered or unexported fields
}
Cursor walks history during replay.
func (*Cursor) Expect ¶
Expect consumes the next event and requires typ. On mismatch or exhaustion it returns a ReplayError (exhaustion means the caller should schedule a command instead — use TakeOrCommand).
func (*Cursor) Next ¶
Next returns the next event, or false when the cursor has caught up (the workflow must then emit commands).
type Event ¶
type Event struct {
Seq int64
Type EventType
Payload json.RawMessage
}
Event is one append-only history record.
type EventType ¶
type EventType string
EventType classifies a history event.
const ( EventWorkflowStarted EventType = "WorkflowStarted" EventWorkflowCompleted EventType = "WorkflowCompleted" EventWorkflowFailed EventType = "WorkflowFailed" EventWorkflowCancelled EventType = "WorkflowCancelled" EventWorkflowSuspended EventType = "WorkflowSuspended" EventOperationScheduled EventType = "OperationScheduled" EventOperationCompleted EventType = "OperationCompleted" EventOperationFailed EventType = "OperationFailed" EventTimerStarted EventType = "TimerStarted" EventTimerFired EventType = "TimerFired" EventSignalReceived EventType = "SignalReceived" EventMarkerRecorded EventType = "MarkerRecorded" )
type History ¶
type History struct {
Events []Event
}
History is an append-only ordered event log.
type ReplayError ¶
type ReplayError struct {
Msg string
}
ReplayError is a non-deterministic or corrupt-history failure.
func (ReplayError) Error ¶
func (e ReplayError) Error() string