-
Notifications
You must be signed in to change notification settings - Fork 528
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Temp File For
layout.{Write,Append,Replace}
Image/Index Methods (…
…#1226) * Add layout.WriteLayer for streaming layers and undersized layers from incomplete downloads WriteLayer is an alternative to WriteBlob which can be used with streaming layers which have not yet calculated a digest or size. A temporary file is first written and then renamed when the reader has been fully consumed. Also, existing layers which do not have the correct size (and thus invalid hashes, but the hash is not checked) are overwritten. {Append,Replace,Write}{Image,Layer} functions utilize WriteLayer instead of WriteBlob to correctly overwrite undersized layers which were previously ignored without error. Undersized layers should no longer occur, since WriteLayer writes to a temporary file first, but when WriteBlob was used, these were common due to incomplete downloads. * Improve error messages for validate.Image and validate.Index when layer blob content is truncated * Unexport `layout.WriteLayer`; Implement suggested changes for validateLayers and temp file naming * Add tests for closing stream.Layer * Check size of blob written when expected size is known * Clean up temp file when layout.WriteBlob errors * Refactor `stream.compressedReader` to have less access to mutable fields and fix data race * Panic when `(layout.Path).writeBlob` is called with invalid arguments * Warn when temp file cleanup fails after failing to write a blob
- Loading branch information
1 parent
a5c1d03
commit ca48523
Showing
5 changed files
with
490 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.