CMDCOrchestrator.Node behaviour (cmdc_orchestrator v0.6.0)

Copy Markdown View Source

编排节点 behaviour。

cmdc_orchestrator 0.4 起,Executor 通过 registry 分发节点执行,避免 在执行器里继续堆叠节点类型分支。自定义节点必须实现本 behaviour,并保证 持久化配置是 JSON/YAML 安全数据。

Summary

Types

节点执行上下文。

Types

context()

@type context() :: %{
  optional(:agent_opts) => keyword(),
  optional(:runtime) => CMDCOrchestrator.Runtime.t() | nil,
  optional(:dry_run?) => boolean()
}

节点执行上下文。

Callbacks

execute(node, dep_results, context)

@callback execute(node :: map(), dep_results :: map(), context()) ::
  {:ok, term()} | {:error, term()}

preflight(node, context)

@callback preflight(node :: map(), context()) :: :ok | {:error, term()}

schema()

@callback schema() :: map()

serializable?()

@callback serializable?() :: boolean()