-
Notifications
You must be signed in to change notification settings - Fork 72
feat: add request hooks infrastructure #188
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
Conversation
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 adds a request lifecycle hooks system to enable intercepting and modifying S3 API requests. The primary purpose is to support client-side load balancing, request telemetry, and debug logging capabilities.
Key changes:
- Introduced
RequestLifecycleHookstrait withbefore_signing_mutandafter_executemethods for request interception - Automatic addition of
x-minio-redirectheader when hooks modify request URLs to inform servers about client-side redirections - Removed old disabled debug logging code in favor of the new hook pattern
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/s3/error.rs | Added Hook variant to ValidationErr for reporting hook execution failures |
| src/s3/client/hooks.rs | New module defining the RequestLifecycleHooks trait with comprehensive documentation and unit tests |
| src/s3/client.rs | Integrated hooks into client builder and request execution flow, including hook invocation and x-minio-redirect header logic |
| examples/debug_logging_hook.rs | New example demonstrating practical usage of hooks for debug logging |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
8a08804 to
e73f5f8
Compare
|
@twuebi Added a load balancing example that uses the hooks |
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
Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
Cargo.toml:4
- Rust edition '2024' does not exist. The latest stable Rust edition as of my knowledge cutoff (January 2025) is 2021. This should be changed to
edition = \"2021\".
edition = "2024"
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Adds RequestHooks trait to enable intercepting and modifying S3 API requests at key points in the request lifecycle. This enables implementing cross-cutting concerns like load balancing, telemetry, and debug logging without modifying the core request handling logic.
Adds RequestHooks trait to enable intercepting and modifying S3 API
requests at key points in the request lifecycle. This enables implementing
cross-cutting concerns like load balancing, telemetry, and debug logging
without modifying the core request handling logic.
Key features:
inform servers about client-side redirections
Implementation details:
Added comprehensive documentation:
Testing:
error handling, and default implementations
Example usage:
Related optimizations:
This commit message: