Documentation
¶
Overview ¶
Package protocol owns Temporal raw JSON and native failure envelopes.
Index ¶
Constants ¶
const ErrorType = "arkoren.error"
ErrorType is the Temporal application error type of a failure that carries the workflow.EncodeError envelope as its first detail.
Variables ¶
var ErrTerminated = workflow.NewError("temporal.terminated", "temporal: workflow terminated")
ErrTerminated reports a run that an operator terminated. Status reports such a run as workflow.Failed.
Functions ¶
func FromTemporal ¶
FromTemporal maps an error of the Temporal client or SDK to a workflow error. It walks the SDK's single-cause chain in order: an outer timeout must not be masked by its previous application failure, and an outer application failure must not become its timeout cause. Unknown errors, including composite errors outside the native failure chain, pass through without value equality.
Types ¶
type Payload ¶
type Payload []byte
Payload carries the facade bytes, which are always JSON, as a raw JSON value in the Temporal payload, so the Temporal UI shows plain JSON. A named type keeps the SDK from using its binary converter.
func DecodeInput ¶
DecodeInput accepts both traced and legacy inputs. Decoding is deterministic and does not create spans, read the clock, or change orchestration history.
func EncodeInput ¶
EncodeInput attaches a carrier without modifying the facade envelope. JSON encoding errors are returned rather than submitting a partially encoded run.
func (Payload) MarshalJSON ¶
MarshalJSON returns the bytes as they are, or null when empty. Nonempty results alias the retained payload and must be treated as read-only by native converters; the method never changes the persisted envelope shape.
Example:
value := payload(`{"v":true}`)
encoded, err := value.MarshalJSON()
if err != nil {
return err
}
_ = string(encoded) // {"v":true}
func (*Payload) UnmarshalJSON ¶
UnmarshalJSON keeps a copy of the raw value. It may reuse the receiver's storage, but never retains the input slice. Syntax validation belongs to the surrounding native JSON decoder.
Example:
var value payload
input := []byte(`{"v":true}`)
if err := value.UnmarshalJSON(input); err != nil {
return err
}
clear(input) // The decoded payload remains unchanged.