Syntropy.ClusterInventory (syntropy v0.1.0)

Copy Markdown

RPC-safe cluster inventory and invalidation boundary for Syntropy.

Each node remains the source of truth for its own agents and local runtime state. This module aggregates those local exports without replicating supervisor state.

Summary

Types

active_task_export()

@type active_task_export() :: %{
  task_id: String.t(),
  coordinator_node_id: String.t(),
  selected_agents: [agent_ref()],
  started_at: DateTime.t()
}

agent_export()

@type agent_export() :: map()

agent_ref()

@type agent_ref() :: %{id: String.t(), runtime_id: String.t(), node_id: String.t()}

cluster_export()

@type cluster_export() :: %{
  status: String.t(),
  local_node_id: String.t(),
  local_node_name: String.t(),
  nodes: [node_export()],
  unavailable_nodes: [map()]
}

node_export()

@type node_export() :: %{
  node_id: String.t(),
  node_name: String.t(),
  services: [Syntropy.ClusterInfo.service_health()],
  agents: [agent_export()],
  active_tasks: [active_task_export()]
}

Functions

active_tasks()

@spec active_tasks() :: [active_task_export()]

busy_runtime_ids(local_active_tasks \\ [])

@spec busy_runtime_ids([active_task_export()]) :: MapSet.t(String.t())

cluster_agents()

@spec cluster_agents() :: [agent_export()]

cluster_export(opts \\ [])

@spec cluster_export(keyword()) :: cluster_export()

fetch_agent(runtime_id)

@spec fetch_agent(agent_ref() | String.t()) :: agent_export() | nil

find_agent(identifier)

@spec find_agent(String.t()) :: agent_export() | nil

local_export(opts \\ [])

@spec local_export(keyword()) :: node_export()

notify_change(reason)

@spec notify_change(String.t() | atom()) :: :ok

receive_remote_change(payload)

@spec receive_remote_change(map()) :: :ok