Skip to content

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

wip: minio client-hooks #168

wants to merge 1 commit into from

Conversation

twuebi
Copy link
Contributor

@twuebi twuebi commented Jun 17, 2025

Adds a RequestLifecycleHoojks trait 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.

@twuebi twuebi added the enhancement Used in release doc generation label Jun 17, 2025
@HJLebbink HJLebbink requested a review from Copilot June 24, 2025 07:26
Copy link
Contributor

@Copilot Copilot AI left a 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 ClientHooks with two async hook points: before_signing_mut and after_execute
  • Wire up hooks in ClientBuilder and call them in Client::request before signing and after execution
  • Add a new Error::Hook variant 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 hooks to hook for clarity and consistency.
    pub fn hook(mut self, hooks: Arc<dyn ClientHooks + Send + Sync + 'static>) -> Self {

src/s3/error.rs:185

  • [nitpick] The Hook variant could be renamed to HookError or InterceptorError to 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_mut and after_execute are called correctly and that errors propagate as expected.
        for hook in self.shared.client_hooks.iter() {

@HJLebbink
Copy link
Member

@twuebi Can we merge this functionality into the main branch? Are we missing anything?

@twuebi
Copy link
Contributor Author

twuebi commented Jun 24, 2025

@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.

@twuebi twuebi force-pushed the tp/lb branch 3 times, most recently from 52ab2c4 to 01783a4 Compare June 26, 2025 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Used in release doc generation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants