Skip to main content

Module ctx

Module ctx 

Source
Expand description

The runtime context shared by every call.

Owns the config, the session (loaded from and saved through a SessionStore), the HTTP client and the hydra refresh policy. The library never reads files or the environment: the embedder passes the config, a session store and a cache to Context::new. Service code calls Context::call with a prepared request; the context attaches the hydra token, and on a hydra rejection it re-mints once (native or via CDP, per config) and retries.

It also owns the response cache (CacheHandle over a Cache); read-only browse calls go through Context::cached_call. Never route cart/quote/order/auth calls through the cache (see the safety notes in crate::cache).

Structsยง

Context