-
Notifications
You must be signed in to change notification settings - Fork 72
wip: minio client-hooks #168
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: master
Are you sure you want to change the base?
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 new ClientHooks trait for plugging into the S3 client request lifecycle, wires those hooks into the ClientBuilder and Client execution steps, and extends error handling to surface hook failures.
- Define
ClientHookswith two async hook points:before_signing_mutandafter_execute - Wire up hooks in
ClientBuilderand call them inClient::requestbefore signing and after execution - Add a new
Error::Hookvariant and display formatting for hook errors
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/s3/error.rs | Add Hook error variant and display implementation |
| src/s3/client/hooks.rs | New ClientHooks trait with default hook methods |
| src/s3/client.rs | Integrate hooks into builder and request flow |
| Cargo.toml | Add spacing (no functional change) |
Comments suppressed due to low confidence (3)
src/s3/client.rs:148
- [nitpick] The parameter is a single hook, so rename
hookstohookfor clarity and consistency.
pub fn hook(mut self, hooks: Arc<dyn ClientHooks + Send + Sync + 'static>) -> Self {
src/s3/error.rs:185
- [nitpick] The
Hookvariant could be renamed toHookErrororInterceptorErrorto more clearly indicate this is an error type.
Hook {
src/s3/client.rs:689
- There are no tests covering the new hook invocation paths; consider adding unit tests to verify that
before_signing_mutandafter_executeare called correctly and that errors propagate as expected.
for hook in self.shared.client_hooks.iter() {
|
@twuebi Can we merge this functionality into the main branch? Are we missing anything? |
Since it's a public facing API we may wanna think a bit of other hooks / names for things since they will be hard to change once released, otherwise, I think we should be good, I'll do another pass tomorrow morning. |
52ab2c4 to
01783a4
Compare
Adds a
RequestLifecycleHoojkstrait which can be used to hook into certain points in a request life-cycle. For now, it only adds two hooks but we may add more hooks in the future as we need them.