Skip to main content

build_rpc_ops_filter

Function build_rpc_ops_filter 

Source
pub fn build_rpc_ops_filter(
    ops: &'static [OpDescriptor],
) -> impl Fn(&Request<Body>) + Send + Sync
Expand description

Build a rate-limit filter function for RPC schemas.

Returns a function that:

  • Extracts op_id from /rpc/{op_id} paths
  • Looks up the op in the provided descriptors
  • Returns false (exempt) if rate_limited_by_default is false
  • Returns true (apply rate limit) if the op participates, or if lookup fails

Fails closed: if descriptor lookup misses for any reason, the op is rate-limited. This prevents accidental exemptions from missing data.

/rpc/batch is always rate-limited regardless of its contents — see the module-level “Known limitation” doc above.