Documentation
¶
Overview ¶
Package workflow defines durable saga and outbox contracts without storage implementations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClaimOptions ¶
type Completion ¶
type Completion struct {
DispatchID string
Attempt uint64
LeaseToken string
Outcome invocation.OutcomeClass
Result json.RawMessage
Error string
NextAttemptAt time.Time
Exhausted bool
Now time.Time
}
type CreateSagaRequest ¶
type Dispatch ¶
type Dispatch struct {
ID string
SagaID string
EffectID string
Sequence int
Direction invocation.Direction
Verb string
ContractHash string
Arguments json.RawMessage
ArgumentHash string
IdempotencyKey string
State DispatchState
Attempt uint64
LeaseOwner string
LeaseToken string
LeaseDeadline time.Time
NextAttemptAt time.Time
Fencing []FencingRequirement
FencingGrants []invocation.FencingGrant
LastOutcome invocation.OutcomeClass
LastError string
Result json.RawMessage
Revision uint64
CreatedAt time.Time
UpdatedAt time.Time
}
type DispatchAttempt ¶
type DispatchAttempt struct {
DispatchID string
Attempt uint64
LeaseOwner string
LeaseToken string
LeaseDeadline time.Time
FencingGrants []invocation.FencingGrant
Outcome invocation.OutcomeClass
Error string
StartedAt time.Time
CompletedAt time.Time
}
type DispatchState ¶
type DispatchState string
const ( DispatchQueued DispatchState = "queued" DispatchInFlight DispatchState = "in_flight" DispatchSucceeded DispatchState = "succeeded" DispatchRetryWait DispatchState = "retry_wait" DispatchFailedPermanent DispatchState = "failed_permanent" DispatchBlockedUnknown DispatchState = "blocked_unknown" DispatchBlockedFence DispatchState = "blocked_fence" )
type EnqueueStepRequest ¶
type FencingRequirement ¶
type OutboxStore ¶
type OutboxStore interface {
CreateSaga(context.Context, CreateSagaRequest) (*SagaInstance, error)
EnqueueStep(context.Context, EnqueueStepRequest) (*Dispatch, error)
ClaimDispatch(context.Context, ClaimOptions) (*Dispatch, error)
SaveFencingGrants(context.Context, string, uint64, string, []invocation.FencingGrant) error
CompleteDispatch(context.Context, Completion) error
CompleteSaga(context.Context, string) error
GetSaga(context.Context, string) (*SagaInstance, error)
GetDispatch(context.Context, string) (*Dispatch, error)
ListDispatches(context.Context, string) ([]*Dispatch, error)
ListAttempts(context.Context, string) ([]DispatchAttempt, error)
}
type SagaInstance ¶
type SagaState ¶
type SagaState string
const ( SagaRunning SagaState = "running" SagaCompleted SagaState = "completed" SagaCompensating SagaState = "compensating" SagaCompensated SagaState = "compensated" SagaFailed SagaState = "failed" SagaBlockedUnknown SagaState = "blocked_unknown" SagaBlockedDependency SagaState = "blocked_dependency" SagaBlockedFence SagaState = "blocked_fence" SagaBlockedCompensation SagaState = "blocked_compensation" )
type SagaStep ¶
type SagaStep struct {
SagaID string
EffectID string
Sequence int
Verb string
ContractHash string
Arguments json.RawMessage
ArgumentHash string
CompensationVerb string
CompensationContract string
CompensationArguments json.RawMessage
CompensationArgumentHash string
Fencing []FencingRequirement
State StepState
Result json.RawMessage
}
type UnknownOutcomeRetryPolicy ¶
type UnknownOutcomeRetryPolicy interface {
RetryUnknownOutcome(invocation.Request) bool
}
Click to show internal directories.
Click to hide internal directories.