-
Notifications
You must be signed in to change notification settings - Fork 87
Draft: asynchronous phase handler #237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
4a7588b to
315d8e3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces asynchronous capabilities to the Rust SDK for nginx modules, including async phase handlers, subrequests, and type-safe request context management.
Key Changes:
- Introduces
AsyncHandlertrait and supporting infrastructure for asynchronous HTTP request handling - Adds
RequestContexttrait for type-safe request-specific context data management - Implements
TypeStoragetrait for storing typed values in nginx memory pools - Refactors existing examples to use new
HttpRequestHandlertrait andadd_phase_handlerfunction
Reviewed changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/log.rs | Extracts connection to intermediate variable in logging macro |
| src/http/status.rs | Adds From<HTTPStatus> implementation for ngx_int_t |
| src/http/request_context.rs | Implements RequestContext trait for managing request-specific context |
| src/http/request.rs | Adds HttpHandlerReturn and HttpRequestHandler traits, new request methods |
| src/http/mod.rs | Adds async_request module exports (feature-gated) |
| src/http/conf.rs | Adds HttpPhase enum and add_phase_handler function |
| src/http/async_request.rs | Implements async handler infrastructure and subrequest builder |
| src/core/type_storage.rs | Implements TypeStorage trait for pool-based type storage |
| src/core/pool.rs | Adds remove method for cleaning up pool-allocated values |
| src/core/mod.rs | Exports new type_storage module |
| examples/*.rs | Refactors examples to use new handler registration pattern |
| examples/config | Adds async_request module configuration |
| examples/Cargo.toml | Adds async-related dependencies |
| Cargo.toml | Adds futures dependency |
| .github/workflows/nginx.yaml | Updates CI to load async_request module |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
78a97e6 to
27338b6
Compare
fc28783 to
697c039
Compare
697c039 to
db33cf9
Compare
db33cf9 to
e649eb8
Compare
Introduce RequestContext trait for managing request-specific context data: - Provides create, remove, get, get_mut, and exists methods - Uses pool allocation with cleanup handlers for memory management - Add get_module_ctx_mut method to Request for mutable context access - Update ngx_log_debug_http macro to use request.log() method
e649eb8 to
a15264a
Compare
Add support for asynchronous phase handlers: - Introduce async phase handler framework - Add async request handling capabilities - Implement async/await support for nginx phases - Enable non-blocking request processing
75988d4 to
090268d
Compare
Add asynchronous subrequest functionality: - Implement async subrequest handling - Add support for non-blocking subrequest operations - Enable concurrent subrequest processing - Integrate with async phase handler framework
090268d to
0317cd1
Compare
Draft implementations of the following items are added to SDK: