Jidoka.Cancellation (Jidoka v0.9.0)

Copy Markdown View Source

Typed evidence that an asynchronous Jidoka request was cancelled.

Cancellation is request-scoped runtime data. It is not a turn snapshot and it does not imply that an external side effect was rolled back.

Summary

Types

t()

Opaque request-scoped cancellation signal used by the runtime.

Functions

Builds typed cancellation evidence.

Builds typed cancellation evidence or raises.

Returns true when a runtime context or token has a cancellation request.

Returns the schema for typed cancellation evidence.

Types

t()

@type t() :: %Jidoka.Cancellation{
  cancelled_at_ms: integer(),
  forced?: boolean(),
  reason: :cancelled,
  request_id: binary()
}

token()

@opaque token()

Opaque request-scoped cancellation signal used by the runtime.

Functions

new(attrs)

@spec new(keyword() | map()) :: {:ok, t()} | {:error, term()}

Builds typed cancellation evidence.

new!(attrs)

@spec new!(keyword() | map()) :: t()

Builds typed cancellation evidence or raises.

requested?(context)

@spec requested?(Jidoka.Context.t() | token()) :: boolean()

Returns true when a runtime context or token has a cancellation request.

schema()

@spec schema() :: Zoi.schema()

Returns the schema for typed cancellation evidence.