Skip to content
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

Object Storage: add context param to support request cancellation #4642

Open
jiefenghuang opened this issue Apr 3, 2024 · 0 comments
Open
Assignees
Labels
kind/feature New feature or request

Comments

@jiefenghuang
Copy link
Contributor

What would you like to be added:

type ObjectStorage interface {
	Get(ctx context, key string, off, limit int64, getters ...AttrGetter) (io.ReadCloser, error)
}

// i.e. pass the context instead of context.Background()
func (s *s3client) Get(ctx context, key string, off, limit int64, getters ...AttrGetter) (io.ReadCloser, error) {
     ....
     resp, err := s.s3.GetObjectWithContext(ctx, params, request.WithGetResponseHeader(s3RequestIDKey, &reqID))
}

Why is this needed:

we start goroutines to handle requests for object storage, need to cancel requests in case of exceptions, such as when a timeout happened.

https://github.com/juicedata/juicefs/pull/4582/files/5036cdcfe8d3ec2aa1a3eb166432d1759c6acaa7#r1549113348

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant