Skip to main content

Module context

Module context 

Source
Expand description

Per-request context and hook data bridge for storage hooks.

Uses tokio task-local storage so that per-request data (e.g. tenant ID, conversation store ID from HTTP headers) can reach hooks without threading it through every storage method signature.

Also provides a task-local ExtraColumns bridge so that hooked storage wrappers can pass hook-provided extra column values to backends without changing any storage trait signatures.

Structs§

RequestContext
Per-request context passed to storage hooks.

Functions§

current_extra_columns
Read the current hook extra columns, if set for this task.
current_request_context
Read the current request context, if one is set for this task.
with_extra_columns
Run an async block with the given ExtraColumns available via task-local.
with_request_context
Run an async block with the given RequestContext available via task-local.