Skip to main content

Module request

Module request 

Source
Expand description

Everything one HTTP request resolves once and then shares.

Three things are built here and nowhere else, and each has a rule attached.

  • One schema snapshot per request. Upstream threads a validSchemaController down through every controller entry point so one request cannot evaluate half its work under one schema and half under another (DatabaseController.js:553). A /batch of twenty writes therefore loads schemas once, and every sub-request sees the same table. Doing it per operation is not a performance bug, it is a correctness bug.
  • One role expansion per request. Roles are uncached in 0.2.0, so expanding them per operation would issue two queries per level of the role graph per sub-request. It is also the same correctness argument: two operations in one batch must not disagree about who the caller is.
  • An unknown session token is an error, not anonymity. Downgrading silently meant a client whose session had gone kept working as a public caller, with no signal that authentication had failed.

Structs§

RequestContext
The request-scoped state every handler runs against.

Functions§

resolve
Resolve a request into its context: session, roles, scope, schemas.