ElGraph.Graph (ElGraph v0.3.0)

Copy Markdown View Source

그래프 정의 구조체. ElGraph의 빌더 함수로 구성하고 ElGraph.compile/2로 검증한다.

체크포인트에는 절대 직렬화되지 않는다 — 그래프는 항상 코드에서 재구성된다 (SPEC §3.5).

Summary

Types

MFA + 인자 리스트 {module, fun, extra_args} (mfa()의 arity가 아니라 인자 리스트)

노드 구현: MFA(+인자) 또는 2-인자 함수 (state, ctx)

조건부 엣지 라우터: MFA(+인자) 또는 1-인자 함수 (state) -> 노드 | :end

t()

Types

mfargs()

@type mfargs() :: {module(), atom(), [term()]}

MFA + 인자 리스트 {module, fun, extra_args} (mfa()의 arity가 아니라 인자 리스트)

node_run()

@type node_run() :: mfargs() | (map(), ElGraph.Ctx.t() -> term())

노드 구현: MFA(+인자) 또는 2-인자 함수 (state, ctx)

router()

@type router() :: mfargs() | (map() -> atom())

조건부 엣지 라우터: MFA(+인자) 또는 1-인자 함수 (state) -> 노드 | :end

t()

@type t() :: %ElGraph.Graph{
  edges: %{required(atom()) => [atom()]},
  entry: atom() | nil,
  nodes: %{required(atom()) => %{run: node_run(), opts: keyword()}},
  routers: %{required(atom()) => router()},
  state_def: %{
    required(atom()) => %{default: term(), reducer: mfargs() | function() | nil}
  }
}