-
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 |
} | ||
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]>
// 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.
I think we need a means to configure the mime type of the blob to serve artifacts. Going forward, I anticipate users to create their custom layer types for LLM etc.
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.
The way the ImageDestination
API works, PutBlob
doesn’t typically need to worry about the MIME type: the MIME type comes via PutManifest
.
While it is true that the PutBlobWithOptions
gets a full types.BlobInfo
, and
Line 852 in 0c42f2f
blobInfo, diffIDChan, err := ic.copyLayerFromStream(ctx, srcStream, types.BlobInfo{Digest: srcInfo.Digest, Size: srcBlobSize, MediaType: srcInfo.MediaType, Annotations: srcInfo.Annotations}, diffIDIsNeeded, toEncrypt, bar, layerIndex, emptyLayer) |
Line 168 in 0c42f2f
stream.info = types.BlobInfo{ // FIXME? Should we preserve more data in src.info? |
PutBlobOptions.IsConfig
).
Also, specifically in the OCI transport, the PutBlob*
code really doesn’t care about the MIME type. It is going to create a sha256-named file, and as far as the layout definition is concerned, it’s perfectly valid to refer to a single blob in two different manifests using two different MIME types. So, for this OCI-transport-specific function, I don’t think adding a MIME type is right.
Opened #2633 to kick this PR over the finish line. |
Includes @sourceIndex code from #1677 .
Do not merge:
oci/archive
at the same time? Structureoci/internal
accordingly either way.