Jidoka.Operation.Source behaviour (Jidoka v0.9.0)

Copy Markdown View Source

Behaviour and compiler for operation sources.

Operation sources normalize external executable surfaces into Jidoka.Agent.Spec.Operation data plus one runtime capability. The turn loop still sees a single operation model.

Summary

Callbacks

Returns the runtime capability that executes operations from a source.

Returns portable source metadata when the source supports it.

Returns the model-visible operations exposed by a source.

Functions

Loads the runtime capability from one operation source.

Compiles one or more sources into operation data and one routed capability.

Loads portable metadata from one operation source.

Loads model-visible operations from one operation source.

Types

compiled()

@type compiled() :: %{
  operations: [Jidoka.Agent.Spec.Operation.t()],
  capability: Jidoka.Operation.Capability.t(),
  metadata: [map()]
}

source()

@type source() :: struct()

Callbacks

capability(source, keyword)

@callback capability(
  source(),
  keyword()
) :: {:ok, Jidoka.Operation.Capability.t()} | {:error, term()}

Returns the runtime capability that executes operations from a source.

metadata(source, keyword)

(optional)
@callback metadata(
  source(),
  keyword()
) :: {:ok, [map()]} | {:error, term()}

Returns portable source metadata when the source supports it.

operations(source, keyword)

@callback operations(
  source(),
  keyword()
) :: {:ok, [Jidoka.Agent.Spec.Operation.t()]} | {:error, term()}

Returns the model-visible operations exposed by a source.

Functions

capability(source, opts \\ [])

@spec capability(
  source(),
  keyword()
) :: {:ok, Jidoka.Operation.Capability.t()} | {:error, term()}

Loads the runtime capability from one operation source.

compile(sources, opts \\ [])

@spec compile(
  [source()] | source(),
  keyword()
) :: {:ok, compiled()} | {:error, term()}

Compiles one or more sources into operation data and one routed capability.

metadata(source, opts \\ [])

@spec metadata(
  source(),
  keyword()
) :: {:ok, [map()]} | {:error, term()}

Loads portable metadata from one operation source.

operations(source, opts \\ [])

@spec operations(
  source(),
  keyword()
) :: {:ok, [Jidoka.Agent.Spec.Operation.t()]} | {:error, term()}

Loads model-visible operations from one operation source.