CouncilEx.Members.SubCouncilAdapter (CouncilEx v0.1.0)

Copy Markdown View Source

Compile-time generator for sub-council member shims. A council member declared with member :id, council: SubCouncil produces a shim module satisfying CouncilEx.Member plus a __sub_council__/0 callback that CouncilEx.Runner.RoundExec uses to branch into sub-council execution.

Two construction paths:

  • Static path (compile-time, via the macro at member/2) — escapes the target/mapper/opts directly into the shim's body. Mappers must be remote captures; that is enforced by the macro caller.

  • Dynamic path (runtime, via CouncilEx.DynamicCouncil.to_spec/1) — stores the target/mapper/opts in a shared ETS table keyed by the shim module. The shim's __sub_council__/0 reads from ETS at call time, which lets the mapper be any anonymous function (e.g., the result of a runtime registry lookup).

Summary

Functions

Build a shim module for a council:-style member.

Functions

build(member_id, sub_council, opts)

@spec build(atom(), module() | CouncilEx.DynamicCouncil.t(), keyword()) :: module()

Build a shim module for a council:-style member.

sub_council may be either a static council module (atom) or a %CouncilEx.DynamicCouncil{} struct — CouncilEx.start/3 dispatches polymorphically on both.

Returns the generated module name. The shim implements the CouncilEx.Member behaviour with no-op defaults and exports __sub_council__/0 returning {sub_council_target, input_mapper_fun, sub_opts}.