mcl_core_guard_pipeline (mcl_core v1.0.0)

View Source

The inbound guard pipeline (mcl-om#13): a macula_response handler that runs every inbound call through the guard stages, in order, before delegating to the capability''s own handler.

EVERY response-kind capability advertised through mcl_core_capabilities flows through this pipeline by default -- including the framework''s own info and 'describe' -- because advertise_one/6 wraps its handler with 'wrapper/3'. A capability opts out deliberately with guard => none (the reason lives in the service''s own code), and streamer-kind capabilities keep their own path (macula_streamer has no macula_response contract to wrap). The stage order is fixed: size first (cheapest refusal), then rate, then the handler -- see mcl-core_guard_stage for why it is deliberately not user-composable.

A denial is reported exactly as the echo did before this existed: {error, payload_too_large | rate_limited, State}, which the wire carries as handler_error.

Summary

Functions

The advertise-time wrap: declare the capability''s limits, then either hand back the handler untouched (guard => none, or a streamer), or hand back this pipeline carrying the handler.

Functions

handle_request(Payload, State)

init(_)

wrapper(OrgProcedure, Cap, Handler)

-spec wrapper(binary(), mcl_core_service:capability(), {module(), term()}) -> {module(), term()}.

The advertise-time wrap: declare the capability''s limits, then either hand back the handler untouched (guard => none, or a streamer), or hand back this pipeline carrying the handler.