-
Notifications
You must be signed in to change notification settings - Fork 379
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
WIP: oci/layout API extensions #2567
base: main
Are you sure you want to change the base?
Conversation
13d3ebf
to
41446dc
Compare
Added |
// It computes, and returns, the digest and size of the used file. | ||
// | ||
// This function can be used instead of dest.PutBlob() where the ImageDestination requires PutBlob() to be called. | ||
func PutBlobFromLocalFile(ctx context.Context, dest types.ImageDestination, file string) (digest.Digest, int64, error) { |
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.
Let's make this more general by allowing the caller to pass a file descriptor instead, with a sugar wrapper method that opens for them if need be?
Or is this function already sugar basically and the functionality would already be exposed by PutBlobWithOptions
as is?
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.
No, a file descriptor is a good idea — assuming Go has a good enough platform abstraction for it.
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.
On second thought, accepting a file descriptor brings up various questions, like “what does it mean if the file descriptor is positioned 1 GB into the file?”.
The use case we have now is to accept a path on the CLI, so a path-based interface is exactly what we need and avoids having to think about these things.
We can always add another function later.
} | ||
defer reader.Close() | ||
|
||
// This makes a full copy; instead, if possible, we could only digest the file and reflink (hard link?) |
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.
Note to self: c/storage/drivers/copy.CopyRegular…
i accidentally deleted my earlier comment, but I have been using the layout.List portion of this PR and it is working nicely. Will test the latest addition here soon. |
Port all tests from containers#1677 , and see what else! Signed-off-by: Miloslav Trmač <[email protected]>
Signed-off-by: Miloslav Trmač <[email protected]>
WIP: For this to actually make any sense, it should be able to avoid the copy. Signed-off-by: Miloslav Trmač <[email protected]>
Includes @sourceIndex code from #1677 .
Do not merge:
oci/archive
at the same time? Structureoci/internal
accordingly either way.