You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Every kind of module has a parameter list of its own, so handing a module one more value changes every trait #1267
Each kind of module is called with its own parameter list. A device module is handed request_info and services, an Edge Cookie module request_info, an IdentityInput and services, a permission signal module the consent and the evidence, and a route the settings and the services. Handing any of them one more value, such as the permissions resolved for the request, means changing that trait and every implementation of it, in this repository and in every vendor's crate.
Nothing in those lists says which values a module may use. The location, the device signals and the Edge Cookie identifier each need a permission to use, and a module is handed them whether or not it declares that permission.
The change
Core builds one context for a request where it calls modules, and a module names what it needs from it. The trait method takes a ModuleCall, and the module hands it a function of its own whose parameters name the values it wants, which are the request (method, path, query, host and scheme), the reader's evidence, the connection, the resolved permissions, the decoded consent, the settings, the services, the location, the device signals or the Edge Cookie identifier. A parameter may be an Option, which is None when the value cannot be passed. A function that names a value directly is not called when the value cannot be passed, and the reason goes to the debug log.
A value whose use needs a permission is passed only to a module that declares that permission and is granted it on the request. required_permissions is new on the signal and route traits, with none declared by default.
The four module traits change once, on purpose, so that a further value later is one more parameter a function may name and not a change to every implementation. Every module in the repository is converted. A request preparer and a response finalizer stay plain functions on the builder, because a preparer holds the request before anything about it is resolved.
Where it is
Built and checked as a draft on the fork, jwrosewell#3, on top of the integration seam (#1094). The pull request to this repository follows when the stack above #1094 is complete.
Activity