-
Notifications
You must be signed in to change notification settings - Fork 385
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
copy/multiple: split selection of images to be copied in copyMultipleImages
#1982
Conversation
@mtrmac PTAL |
cd47ec0
to
0263055
Compare
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.
This works well enough right now, but it will ~immediately need to be replaced when implementing the “add a new Zstd variant” feature; there’s no clean way to represent that.
We could hack that with ListOperation: ListOpAdd, AddDigest: theOldDigestToConvert
; that would be ugly, but it would work once for the “add a Zstd variant” feature. But then someone may want an “add a gzip variant”… and we are missing a field where to recordwhat kind of modification we should make.
So I think it’s cleaner to add a separate struct immediately, like the original version of #1883 did e.g. in 941cd13 .
@mtrmac How about new struct could look like this ? type addOperation int
const (
addop_compress_gzip addOperation = iota
addop_compress_zstd
)
type instanceCopy struct {
instance internal.ListEdit
addOp addOperation
} |
I was thinking vaguely /* enum instanceCopyKind {
instanceCopyCopy // a single copy, replacing the original
instanceCopyClone // creating a new copy of the original, not replacing it
} */
type instanceCopy {
op instanceCopyKind
sourceDigest // digest in the source == instance ID
// otherCopyOptions: for now maybe just
forceZstd bool
} That’s assuming that after we do an instance copy, we have some other code to determine that we need to adjust the Zstd annotation, and that the annotation update doesn’t need to be represented here. Maybe we don’t need a new |
0e0cd7d
to
8ec2734
Compare
8ec2734
to
98b9147
Compare
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.
Thanks! A few more cleanups, please.
98b9147
to
bd6a6ae
Compare
@mtrmac PTAL again :) |
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.
Thanks! LGTM.
Following PR splits `copyMultipleImages` into a new function called `prepareCopyInstances` which returns a list of `instanceCopy`. `prepareCopyInstances` does that in these two steps * How to copy via instanceCopyKind * What to copy by the content of the returned list. See newly added unit test to see how it is used. Signed-off-by: Aditya R <[email protected]>
bd6a6ae
to
286f012
Compare
Following PR splits
copyMultipleImages
into a new function calledprepareCopyInstances
which returns a list ofinstanceCopy
.prepareCopyInstances
does that in these two stepsSee newly added unit test to see how it is used.