mcl_core_guard_stage behaviour (mcl_core v1.0.0)

View Source

The stage behaviour the inbound guard pipeline runs per request, in order.

A stage is a small module answering ONE question about an inbound call: pass it on, or deny it. The pipeline (mcl_core_guard_pipeline) is the only caller, in the fixed order its wrapper names; a stage never calls another stage, and the request context is read-only.

The stages are FIXED ORDER, not arbitrary composition -- size first (the cheapest refusal), then rate -- a chain of two well-understood stages, deliberately not a user-composable one (mcl-om#13).

Summary

Types

ctx/0

-type ctx() :: #{procedure := binary(), limits := map(), caller := binary() | '$global'}.

verdict/0

-type verdict() :: pass | {deny, term()}.

Callbacks

check/2

-callback check(term(), ctx()) -> verdict().