Plexus (Plexus v0.1.0)

Copy Markdown View Source

Single-node kernel for massively asynchronous semantic computation.

Plexus keeps TypeSafeSDK as the semantic measurement engine and adds run-scoped population/topology, declarative actor effects, batching/dedupe, budgets, scheduling regimes, replay and an explicit expansion seam.

Summary

Types

actor_ref()

@type actor_ref() :: pid() | {run_ref(), term()}

run_ref()

@type run_ref() :: pid() | term()

Functions

actor_pid(run, actor_id)

@spec actor_pid(run_ref(), term()) :: {:ok, pid()} | {:error, :not_found}

See Plexus.Run.actor_pid/2.

barrier(run)

@spec barrier(run_ref()) :: {:ok, non_neg_integer(), non_neg_integer()}

budget(run)

@spec budget(run_ref()) :: map()

call(actor_ref, message, timeout \\ 5000)

@spec call(actor_ref(), term(), timeout()) :: term()

cast(pid, message)

@spec cast(actor_ref(), term()) :: :ok | {:error, :not_found}

contract(questions)

@spec contract(keyword()) :: TypeSafeSDK.Prepared.t()

See Plexus.Contract.new!/1.

dispatch(context, commands)

@spec dispatch(map(), Plexus.Actor.Command.t() | [Plexus.Actor.Command.t()]) :: :ok

See Plexus.Actor.dispatch/2.

events(run)

@spec events(run_ref()) :: [map()]

load_replay(run, entries)

@spec load_replay(run_ref(), Enumerable.t()) :: :ok

prune(run, actor_id)

@spec prune(run_ref(), term()) :: :ok

See Plexus.Run.prune/2.

publish(run, event, payload \\ nil)

@spec publish(run_ref(), term(), term()) :: non_neg_integer()

register_contract(run, name, prepared_or_questions, opts \\ [])

@spec register_contract(
  run_ref(),
  term(),
  TypeSafeSDK.Prepared.t() | keyword(),
  keyword()
) :: :ok

replay_entries(run)

@spec replay_entries(run_ref()) :: [{String.t(), term()}]

schedule(run, regime)

@spec schedule(run_ref(), Plexus.Schedule.regime()) :: :ok

start_actor(run, opts)

@spec start_actor(run_ref(), keyword()) :: DynamicSupervisor.on_start_child()

See Plexus.Run.start_actor/2.

start_run(opts)

@spec start_run(keyword()) :: {:ok, pid()} | {:error, term()}

See Plexus.Run.start_run/1.

stop_run(run, reason \\ :normal)

@spec stop_run(run_ref(), term()) :: :ok | {:error, :not_found}

See Plexus.Run.stop_run/2.

subtree(run, actor_id)

@spec subtree(run_ref(), term()) :: [term()]