View Source Jido.Agent.Runtime.Process (Jido v1.0.0-rc.5)

Helper module for managing child processes under the Runtime's DynamicSupervisor.

Summary

Functions

Lists all child processes currently running under the Runtime's DynamicSupervisor.

Restarts a specific child process under the Runtime's DynamicSupervisor.

Starts a child process under the Runtime's DynamicSupervisor.

Terminates a specific child process under the Runtime's DynamicSupervisor.

Functions

list(state)

@spec list(%Jido.Agent.Runtime.State{
  agent: term(),
  child_supervisor: term(),
  max_queue_size: term(),
  pending: term(),
  pubsub: term(),
  status: term(),
  topic: term()
}) :: [{:undefined, pid(), :worker, [module()]}]

Lists all child processes currently running under the Runtime's DynamicSupervisor.

Returns list of child specifications.

restart(state, child_pid, child_spec)

@spec restart(
  %Jido.Agent.Runtime.State{
    agent: term(),
    child_supervisor: term(),
    max_queue_size: term(),
    pending: term(),
    pubsub: term(),
    status: term(),
    topic: term()
  },
  pid(),
  map()
) :: {:ok, pid()} | {:error, term()}

Restarts a specific child process under the Runtime's DynamicSupervisor.

This is done by terminating the existing process and starting a new one with the same spec.

Returns {:ok, new_pid} if successful, {:error, reason} on failure.

start(state, child_spec)

@spec start(
  %Jido.Agent.Runtime.State{
    agent: term(),
    child_supervisor: term(),
    max_queue_size: term(),
    pending: term(),
    pubsub: term(),
    status: term(),
    topic: term()
  },
  map()
) :: {:ok, pid()} | {:error, term()}

Starts a child process under the Runtime's DynamicSupervisor.

Returns {:ok, pid} if successful, {:error, reason} on failure.

terminate(state, child_pid)

@spec terminate(
  %Jido.Agent.Runtime.State{
    agent: term(),
    child_supervisor: term(),
    max_queue_size: term(),
    pending: term(),
    pubsub: term(),
    status: term(),
    topic: term()
  },
  pid()
) :: :ok | {:error, :not_found}

Terminates a specific child process under the Runtime's DynamicSupervisor.

Returns :ok if successful, {:error, reason} on failure.