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

feature req: ProxyReadSeeker #173

Open
nergdron opened this issue Dec 14, 2020 · 2 comments
Open

feature req: ProxyReadSeeker #173

nergdron opened this issue Dec 14, 2020 · 2 comments

Comments

@nergdron
Copy link

I'm in need of a ProxyReadSeeker to wrap ReadSeekers (like files) for use with the AWS go SDK. stuff like s3.PutObject() says it takes an io.Reader, but really requires an io.ReadSeeker since it reads the data once to calculate checksums and then again to send it to S3.

I'm envisioning that the progress bar goes backwards when it seeks back, and then moves forwards again, basically tracking the current read position as it goes. Hopefully shouldn't be too hard to implement. I'm willing to take a stab at it, if you agree to the general design.

@nergdron
Copy link
Author

the other option I'm thinking about is extending ProxyReader to just handle Seek calls like it handles Close calls, but always return an error if you call Seek() on something that isn't a Seeker underneath. this would mean less code, both in the implementation and in the io_test.go. feedback appreciated!

@cheggaaa
Copy link
Owner

We can't just add Seek to the reader. Some packages can take io.Reader in arguments, but inside do a type check for io.Seeker - in this case, we can mess up the logic.
ProxyReaderSeeker is a solution, but with Seek, it is impossible to correctly calculate the progress (speed, remaining time, etc.) I think it's ok and users will keep this in mind.

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

No branches or pull requests

2 participants