Skip to main content

Module host

Module host 

Source
Expand description

Host-side helpers for procedure execution and principal threading.

Two helpers consolidate the §1.2 duplication flagged in CODE_SIMPLIFIER_FEEDBACK.md:

  • context::build_procedure_context — replaces the duplicated “construct host + attach writer + read principal + build context” block between uni-query/src/query/executor/procedure.rs and uni-query/src/query/df_graph/procedure_call.rs.
  • principal::maybe_scope_with_principal — wraps the conditional match principal { Some(p) => scoped_with_principal(...).await, None => fut.await } pattern duplicated across uni::api::{session,transaction} and uni-query::df_udfs.

The principal task-local (principal::CURRENT_PRINCIPAL) and its scoped_with_principal / current_principal helpers also live here. uni-query re-exports them for backwards compatibility.

Modules§

context
Procedure-context construction helper.
principal
Authenticated-principal task-local plumbing.

Statics§

CURRENT_PRINCIPAL
Tokio task-local carrying the authenticated principal for the in-flight query.

Functions§

build_procedure_context
Build a ProcedureContext wiring host and an optional principal.
current_principal
Borrow the principal active for the current execute scope, if any.
maybe_scope_with_principal
Run fut either inside a principal task-local scope or unwrapped, depending on whether a principal was supplied.
scoped_with_principal
Run fut inside a scope where current_principal resolves to principal.