ExGAM.Adapter (ExGAM v0.1.0)

Copy Markdown View Source

Small, authority-free utilities shared by ExGAM adapter boundaries.

Adapters connect the governed runtime to application code: clocks, ingress, minds, stores, executors, brokers and observers. Discovering a module or calling one of its callbacks never grants authority; it only validates host wiring or crosses an already-declared boundary.

This module intentionally knows nothing about a particular behaviour. Each boundary remains responsible for validating callback results and translating failures into its own domain vocabulary.

Summary

Functions

Invokes a previously validated callback without leaking exception details.

Validates that a loaded module implements every required callback.

Types

callback_spec()

@type callback_spec() :: {atom(), non_neg_integer()}

invocation_error()

@type invocation_error() ::
  {:adapter_callback_exception, module(), atom(), module()}
  | {:adapter_callback_failure, module(), atom(), :exit | :throw}

validation_error()

@type validation_error() ::
  {:invalid_adapter_module, term()}
  | {:adapter_module_not_loaded, module()}
  | {:adapter_callback_missing, module(), atom(), non_neg_integer()}

Functions

invoke(module, callback, arguments)

@spec invoke(module(), atom(), [term()]) ::
  {:ok, term()} | {:error, invocation_error()}

Invokes a previously validated callback without leaking exception details.

validate(module, callbacks)

@spec validate(term(), [callback_spec()]) :: :ok | {:error, validation_error()}

Validates that a loaded module implements every required callback.