Skip to main content

compile_policy

Function compile_policy 

Source
pub fn compile_policy(
    policy: &PolicyConfig,
    resources: Arc<PluginResources>,
) -> Result<CompiledGraph, String>
Expand description

Compiles a PolicyConfig into a ready-to-execute CompiledGraph.

Instantiates each node’s plugin via plugins::create_plugin, records client nodes as terminals, and indexes edges by source port: success and out become success edges, error becomes error edges. The entry node is the target of the listener’s success/out edge. Fails if the policy has no listener node, a plugin cannot be constructed, or an edge uses an unknown source port.

Edge endpoints use the node_id.port form:

edges:
  - from: listener.out
    to: rewrite.in
  - from: rewrite.success
    to: client.in
  - from: rewrite.error
    to: error-handler.in