MingaEditor.Effect.Request (Minga v0.1.0)

Copy Markdown View Source

Typed scheduler request for one domain-owned slow effect.

Requests contain data only. Executable closures and document binaries do not enter scheduler queues; the domain module named by handler owns execution.

Summary

Types

Scheduler-local request identity.

Optional request metadata supplied to the scheduler.

Stable identity for the mutated or calculated resource.

t()

Functions

Combines two queued requests through their shared domain handler.

Builds a scheduler request for a typed effect and optional metadata.

Runs the request through its domain handler.

Types

id()

@type id() :: reference()

Scheduler-local request identity.

option()

@type option() ::
  {:operation_id, MingaEditor.State.Operation.id()}
  | {:source, Minga.Extension.ContributionCleanup.contribution_source() | nil}
  | {:timeout_ms, pos_integer()}
  | {:activity, atom()}

Optional request metadata supplied to the scheduler.

resource()

@type resource() :: term()

Stable identity for the mutated or calculated resource.

t()

@type t() :: %MingaEditor.Effect.Request{
  activity: atom() | nil,
  effect: struct(),
  handler: module(),
  id: id(),
  operation_id: MingaEditor.State.Operation.id() | nil,
  policy: MingaEditor.Effect.Policy.t(),
  resource: resource(),
  source: Minga.Extension.ContributionCleanup.contribution_source() | nil,
  timeout_ms: pos_integer() | nil
}

Functions

coalesce(old_request, new_request)

@spec coalesce(t(), t()) :: t()

Combines two queued requests through their shared domain handler.

new(effect, resource, policy, opts \\ [])

Builds a scheduler request for a typed effect and optional metadata.

run(request)

@spec run(t()) :: {:ok, term()} | {:error, term()}

Runs the request through its domain handler.