-
Notifications
You must be signed in to change notification settings - Fork 104
[cachetools] add NewUploadWriter and tests #9406
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
Conversation
if uw.committed { | ||
return nil | ||
} | ||
if uw.sendErr != nil { |
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.
sendErr could be EOF, right? In that case, do you still want to CloseAndRecv so you can get the committed size?
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.
Good point.
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.
- In
Commit()
,CloseAndRecv()
is still called even ifflush(..)
returnsEOF
. - In
Write(...)
, I opted to returnErrShortWrite
instead ofEOF
. Tests do not seem to be hitting it. - Added test cases for the
UploadWriter
paths.
This change introduces
NewUploadWriter
and tests forUploadWriter
. It leaves theUploadFromReader
path untouched, since my first need forUploadWriter
is as a best-effort writer for caching OCI image layers. A later change will haveUploadFromReader
useUploadWriter
.