Minga.Extension.Instance.Worker (Minga v0.1.0)

Copy Markdown View Source

Linked, monitored, bounded transition work owned by one Instance.

Summary

Types

Identity and cancellation handles for one asynchronous transition.

t()

Functions

Cancels work whose transition lost lifecycle authority.

Cancels timeout/monitor bookkeeping after a matching completion.

Clears timer bookkeeping after a worker DOWN.

Starts linked transition work and arms its deterministic timeout.

Starts transition work with a caller-owned identity for progress messages.

Kills work which exceeded its authority-owned deadline.

Types

failure()

@type failure() ::
  {:transition_worker_failed, kind(),
   {:raise, Exception.t(), Exception.stacktrace()}
   | {:throw | :exit, term(), Exception.stacktrace()}}

kind()

@type kind() :: :start | :terminate | {:finalizer, atom()} | :cleanup

Identity and cancellation handles for one asynchronous transition.

t()

@type t() :: %Minga.Extension.Instance.Worker{
  id: reference(),
  kind: kind(),
  monitor: reference(),
  pid: pid(),
  timer: reference()
}

Functions

cancel(worker)

@spec cancel(t()) :: :ok

Cancels work whose transition lost lifecycle authority.

complete(worker)

@spec complete(t()) :: :ok

Cancels timeout/monitor bookkeeping after a matching completion.

down(worker)

@spec down(t()) :: :ok

Clears timer bookkeeping after a worker DOWN.

start(owner, kind, timeout_ms, fun)

@spec start(pid(), kind(), pos_integer(), (-> term())) :: t()

Starts linked transition work and arms its deterministic timeout.

start(owner, kind, timeout_ms, id, fun)

@spec start(pid(), kind(), pos_integer(), reference(), (-> term())) :: t()

Starts transition work with a caller-owned identity for progress messages.

timeout(worker)

@spec timeout(t()) :: :ok

Kills work which exceeded its authority-owned deadline.