Skip to main content

Module cp

Module cp 

Source
Expand description

Managed-mode client: talk to a remote control plane.

Off by default. When [control_plane] is configured, the edge:

  • pulls its policy (conditional GET, ETag/304) and hot-reloads it through the same build_runtime + arc-swap path a local file edit uses;
  • reports usage (requests + ingress/egress bytes) as periodic deltas;
  • forwards CSP reports it receives to the control plane.

This is a generic “pull config / report usage to a URL” client — it carries no control-plane logic; it just speaks the control plane’s edge HTTP API with a per-tenant bearer token. Built on the same reqwest + rustls stack as the JWKS fetcher (auth.rs).

Structs§

CpClient
Outbound client to a control plane’s per-tenant edge API.
UsageDelta
A usage delta reported to the control plane (matches its /v3/edge/{id}/usage wire shape).

Enums§

PullResult
Outcome of a conditional policy pull.

Functions§

poll_loop
Background loop: poll the control plane for policy and hot-reload it through build_runtime + the arc-swap, exactly like a local file edit. A parse/build failure keeps the current policy.
report_loop
Background loop: flush the usage accumulator to the control plane each period. On a failed report the drained delta is added back so billable usage isn’t lost.