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

S3 Cache: Remove custom readerAt to use the standard one #3993

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bpaquet
Copy link
Contributor

@bpaquet bpaquet commented Jul 5, 2023

Tested with
TESTFLAGS="-run TestIntegration/TestBasicS3CacheImportExport/worker=containerd-rootles"

@bpaquet bpaquet force-pushed the remove_s3_reader_at branch from 428a522 to cbc5e3a Compare July 5, 2023 22:11
@@ -400,7 +392,8 @@ func (s3Client *s3Client) getManifest(ctx context.Context, key string, config *v
return true, nil
}

func (s3Client *s3Client) getReader(ctx context.Context, key string) (io.ReadCloser, error) {
func (s3Client *s3Client) Fetch(ctx context.Context, desc ocispecs.Descriptor) (io.ReadCloser, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order for FromFetcher to be efficient, this io.ReadCloser needs to support either ReadAt or io.Seeker as well. If it does support it then better to make it clear in the exported type.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. I dig around on this interesting question :)

If my analysis is right, I see multiple solutions

  1. Fix the actual code by handling the offset properly, and keep a dedicated ReaderAt
  2. Go forward with my PR. The line https://github.com/moby/buildkit/blob/master/util/contentutil/fetcher.go#L51 will throw an error if the offset sent as parameter is not the good one.

WDYT? I'm more in favor of 1/, even if I feel we have some duplication in the code base.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nobody complains, meaning it's working anyway :)

This would not matter in the default case. Starting from the previous offset would only be required for resuming a previous incomplete pull etc.

If my analysis is right, I see multiple solutions

We should do a better solution than throwing an error for the resuming case. Either by fixing the old ReaderAt or implementing/type-checking Seeker in the new variant.

@bpaquet bpaquet force-pushed the remove_s3_reader_at branch 4 times, most recently from 7c44356 to 60e8e24 Compare July 8, 2023 09:13
@bpaquet bpaquet force-pushed the remove_s3_reader_at branch from 60e8e24 to 070a226 Compare July 8, 2023 10:10
@bpaquet
Copy link
Contributor Author

bpaquet commented Jul 11, 2023

@tonistiigi done :)

@bpaquet
Copy link
Contributor Author

bpaquet commented Aug 22, 2023

@tonistiigi ping :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants