-
Notifications
You must be signed in to change notification settings - Fork 881
image: export ImageListEntry type for image list
#3383
Conversation
s-urbaniak
left a comment
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 have just a small nit to refer to the struct members format, and full inside methods of printableImage instead of referencing the constants flagImageFormat, and flagFullOutput.
Thanks!
rkt/image_list.go
Outdated
| ) | ||
|
|
||
| func (pi *printableImage) imageSize() string { | ||
| if flagImageFormat != outputFormatTabbed || flagFullOutput { |
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.
s/flagImageFormat/pi.format
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.
s/flagFullOutput/pi.full
rkt/image_list.go
Outdated
|
|
||
| func (pi *printableImage) importTime() string { | ||
| t := time.Unix(0, pi.ImportTime) | ||
| if flagImageFormat != outputFormatTabbed || flagFullOutput { |
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.
s/flagImageFormat/pi.format (as above)
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.
s/flagFullOutput/pi.full (as above)
rkt/image_list.go
Outdated
|
|
||
| func (pi *printableImage) lastUsedTime() string { | ||
| t := time.Unix(0, pi.LastUsedTime) | ||
| if flagImageFormat != outputFormatTabbed || flagFullOutput { |
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.
s/flagImageFormat/pi.format (as above)
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.
s/flagFullOutput/pi.full (as above)
8ece396 to
528ecd8
Compare
|
Good catch, addressed. |
|
Also, for some context, this came as a result of the change in rktlet where we're programmatically consuming this and it would be nice to unmarshal into a shared type and not have to do as much string parsing. I feel less bad about the technically backwards incompatible change because this is such a new feature that it's unlikely any other clients exist in the wild. |
s-urbaniak
left a comment
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.
Agreed, the whole functionality is actually marked as experimental, and marked behind an env var.
Reading this I already assumed that this was intended for rtklet ;-)
LGTM on green
|
|
|
asking @lucab for a final pass |
| ImportTime int64 `json:"import_time"` | ||
| // LastUsedTimeNano indicates when was last used in nanoseconds since the | ||
| // unix epoch | ||
| LastUsedTime int64 `json:"last_used_time"` |
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.
Field name and comment don't match (here and in the field above).
|
This LGTM except a very minor nit. I'm not too much concerned about json-out compatibility right now, but I see the problem coming to us in the near future. |
5d737cc to
a140ab2
Compare
This allows external consumers to just directly unmarshal json into this exported type. I modified the types of some of its values for consistency with other exported types as well. This is unfortunately backwards incompatible.
a140ab2 to
9c58da8
Compare
|
Indeed, we now have some form of an API and can "never" remove fields from this value. So we should probably build an integration test that ensures this fact. |
This allows external consumers to just directly unmarshal json into this
exported type.
I modified the types of some of its values for consistency with other
exported types as well. This is unfortunately backwards incompatible.