Skip to content
This repository was archived by the owner on Feb 24, 2020. It is now read-only.

Conversation

@euank
Copy link
Member

@euank euank commented Nov 17, 2016

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.

Copy link
Contributor

@s-urbaniak s-urbaniak left a 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!

)

func (pi *printableImage) imageSize() string {
if flagImageFormat != outputFormatTabbed || flagFullOutput {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/flagImageFormat/pi.format

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/flagFullOutput/pi.full


func (pi *printableImage) importTime() string {
t := time.Unix(0, pi.ImportTime)
if flagImageFormat != outputFormatTabbed || flagFullOutput {
Copy link
Contributor

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)

Copy link
Contributor

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)


func (pi *printableImage) lastUsedTime() string {
t := time.Unix(0, pi.LastUsedTime)
if flagImageFormat != outputFormatTabbed || flagFullOutput {
Copy link
Contributor

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)

Copy link
Contributor

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)

@euank euank force-pushed the image-output-export branch from 8ece396 to 528ecd8 Compare November 17, 2016 08:10
@euank
Copy link
Member Author

euank commented Nov 17, 2016

Good catch, addressed.

@euank
Copy link
Member Author

euank commented Nov 17, 2016

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.

Copy link
Contributor

@s-urbaniak s-urbaniak left a 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

@euank
Copy link
Member Author

euank commented Nov 17, 2016

image list --format=json isn't behind any env var mask afaik, and that's where the backwards incompatibility lies. Maybe worth calling out in release notes.

@s-urbaniak s-urbaniak added this to the v1.20.0 milestone Nov 18, 2016
@s-urbaniak
Copy link
Contributor

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"`
Copy link
Member

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).

@lucab
Copy link
Member

lucab commented Nov 18, 2016

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. list is basically just dumping out our internal DB, so fields will probably have to evolve with it. On top of that we are still defining library types, so some changes are also to be expected there. Should we perhaps start sticking a version field to the JSON we emit? Other options here?

@euank euank force-pushed the image-output-export branch 2 times, most recently from 5d737cc to a140ab2 Compare November 18, 2016 19:46
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.
@squeed
Copy link
Contributor

squeed commented Nov 22, 2016

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.

@lucab lucab merged commit 6038f19 into rkt:master Nov 22, 2016
@euank euank deleted the image-output-export branch November 22, 2016 19:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants