Documentation
¶
Overview ¶
Package wire defines the JSON shapes exchanged between a durable function invocation and the durable execution service: the invocation input with its embedded operation log page, and the invocation response.
The durable package decodes these shapes on every invocation and the durabletest package encodes them to drive a handler locally. Both packages import this one definition so the two sides cannot drift.
This package is internal to the module and is not part of the SDK API.
Index ¶
Constants ¶
const ( StatusSucceeded = "SUCCEEDED" StatusFailed = "FAILED" StatusPending = "PENDING" )
Invocation statuses carried in InvocationResponse.Status.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallbackDetails ¶
type CallbackDetails struct {
CallbackId string `json:"CallbackId,omitempty"`
Result string `json:"Result,omitempty"`
Error *ErrorObject `json:"Error,omitempty"`
}
CallbackDetails carries a callback operation's checkpointed outcome.
type ChainedInvokeDetails ¶
type ChainedInvokeDetails struct {
Result string `json:"Result,omitempty"`
Error *ErrorObject `json:"Error,omitempty"`
}
ChainedInvokeDetails carries a chained invoke's checkpointed outcome.
type ContextDetails ¶
type ContextDetails struct {
Result string `json:"Result,omitempty"`
ReplayChildren bool `json:"ReplayChildren,omitempty"`
Error *ErrorObject `json:"Error,omitempty"`
}
ContextDetails carries a child context's checkpointed outcome.
type ErrorObject ¶
type ErrorObject struct {
ErrorType string `json:"ErrorType,omitempty"`
ErrorMessage string `json:"ErrorMessage,omitempty"`
ErrorData string `json:"ErrorData,omitempty"`
StackTrace []string `json:"StackTrace,omitempty"`
}
ErrorObject is a recorded failure. It appears inside the *Details of a failed operation and as the Error of a FAILED invocation response. Every field is optional on the wire; an empty field is omitted when encoding. StackTrace is a list of frame strings, innermost frame first.
type ExecutionDetails ¶
type ExecutionDetails struct {
// InputPayload is the serialized customer event for the execution.
InputPayload string `json:"InputPayload,omitempty"`
}
ExecutionDetails carries the execution operation's payload fields.
type InitialExecutionState ¶
type InitialExecutionState struct {
Operations []Operation `json:"Operations"`
NextMarker string `json:"NextMarker,omitempty"`
}
InitialExecutionState is the operation log page embedded in the invocation payload. Further pages are fetched with GetDurableExecutionState using NextMarker.
type InvocationInput ¶
type InvocationInput struct {
DurableExecutionArn string `json:"DurableExecutionArn"`
CheckpointToken string `json:"CheckpointToken"`
UpdatedOperationIds []string `json:"UpdatedOperationIds,omitempty"`
InitialExecutionState InitialExecutionState `json:"InitialExecutionState"`
}
InvocationInput is the payload delivered to a durable function invocation. It carries the execution identity, the checkpoint token for this invocation cycle, and the first page of the checkpointed operation log.
The customer event is not a separate field: it travels as the serialized InputPayload of the execution operation inside the initial state.
type InvocationResponse ¶
type InvocationResponse struct {
Status string `json:"Status"`
Result *string `json:"Result,omitempty"`
Error *ErrorObject `json:"Error,omitempty"`
}
InvocationResponse is what a durable invocation returns: the terminal result, a failure, or PENDING when the execution suspends to resume in a later invocation. Result is a pre-serialized JSON string, so it is double-encoded on the wire.
type Operation ¶
type Operation struct {
Id string `json:"Id"`
ParentId string `json:"ParentId,omitempty"`
Status string `json:"Status"`
Type string `json:"Type,omitempty"`
SubType string `json:"SubType,omitempty"`
Name string `json:"Name,omitempty"`
StartTimestamp Timestamp `json:"StartTimestamp,omitempty"`
EndTimestamp Timestamp `json:"EndTimestamp,omitempty"`
ExecutionDetails *ExecutionDetails `json:"ExecutionDetails,omitempty"`
StepDetails *StepDetails `json:"StepDetails,omitempty"`
WaitDetails *WaitDetails `json:"WaitDetails,omitempty"`
ChainedInvokeDetails *ChainedInvokeDetails `json:"ChainedInvokeDetails,omitempty"`
ContextDetails *ContextDetails `json:"ContextDetails,omitempty"`
CallbackDetails *CallbackDetails `json:"CallbackDetails,omitempty"`
}
Operation is the JSON shape of one checkpointed operation in the invocation payload, narrowed to the fields the engine consumes. Exactly one of the *Details fields is populated, selected by Type.
type StepDetails ¶
type StepDetails struct {
Attempt int `json:"Attempt,omitempty"`
Result string `json:"Result,omitempty"`
Error *ErrorObject `json:"Error,omitempty"`
NextAttemptTimestamp *Timestamp `json:"NextAttemptTimestamp,omitempty"`
}
StepDetails carries a step operation's checkpointed attempt state. NextAttemptTimestamp is when the next attempt of a pending retry or condition check is due; the SDK sends its first status poll then.
type Timestamp ¶
Timestamp is a checkpoint timestamp that may arrive as either an RFC3339 string or a numeric epoch-milliseconds value. Valid is false when the field was absent, null, or unparseable.
func (Timestamp) MarshalJSON ¶
MarshalJSON encodes a valid Timestamp as an RFC3339 string and an invalid one as null.
func (Timestamp) Ptr ¶
Ptr returns the timestamp as an optional value: a pointer to Time when Valid, nil otherwise. This is the shape the SDK's exported client types use for optional timestamps.
func (*Timestamp) UnmarshalJSON ¶
UnmarshalJSON accepts null, an RFC3339 string, or an epoch-milliseconds number. Any other value leaves the Timestamp invalid without error, so an unexpected timestamp encoding never rejects the whole payload.
type WaitDetails ¶
type WaitDetails struct {
ScheduledEndTimestamp *Timestamp `json:"ScheduledEndTimestamp,omitempty"`
}
WaitDetails carries a wait operation's scheduled end. The SDK sends its first status poll of a pending wait then.