Skip to content
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

generate: Move Generator.spec to Generator.Config #266

Merged
merged 1 commit into from
Apr 12, 2018

Conversation

wking
Copy link
Contributor

@wking wking commented Nov 7, 2016

This makes the attribute public, since quite a few config manipulations are easier using Go's types than they are via getter/setter/mutator methods. This also means that we can drop methods that are more awkward than direct access (although we'll want to keep methods that are more convenient than direct access). I haven't done any method-dropping in this commit though, aside from the getter/setter for the config itself. I'd called for this back when we started adding these methods, and @mrunalp was sounding more positive about the public-attribute approach a few weeks ago.

I've also renamed this from “spec” to “config”, because it is a config. I'm not sure why runtime-spec decided to call the main config.go type Spec, but I don't think we should repeat that idiosyncrasy. This breaks our current library API in a few places (e.g. NewFromSpecNewFromConfig), but the migration shouldn't be that bad and I think it's worth it to make life easier for future consumers.

@Mashimiao
Copy link

In my opinion, I hope Generator could be a general library in the future. From our side, it can help us keep code of subcommand generate to be concise and other projects or tools may import our library to create container config.
This is my own opinion. We can listen to other people's opinions. @opencontainers/runtime-tools-maintainers

@wking
Copy link
Contributor Author

wking commented Nov 8, 2016

I hope Generator could be a general library in the future.

I agree, and I think this change will help us provide a better API. To help evaluate the change, I'll work up a follow-up PR that builds on this to transition some internal consumers, and we can decide if the transitioned code is more or less concise.

Of course, there may be some benefit in buffering downstream users from runtime-caller Go type changes. I expect those to drop off as runtime-caller stabilizes, but "drop off" isn't "stop". Whether that isolation is worth the cost of writing and maintaining per-property wrappers is a maintainer call.

@wking
Copy link
Contributor Author

wking commented Nov 8, 2016

On Mon, Nov 07, 2016 at 07:33:35PM -0800, W. Trevor King wrote:

To help evaluate the change, I'll work up a follow-up PR that builds
on this to transition some internal consumers, and we can decide if
the transitioned code is more or less concise.

Pushed with #267.

@liangchenye
Copy link
Member

It is already a general library right? @Mashimiao
Changing 'spec' to 'config' makes sense.

@liangchenye
Copy link
Member

Conflicts detected, other wise LGTM

@wking
Copy link
Contributor Author

wking commented Nov 22, 2016

On Tue, Nov 22, 2016 at 03:33:33AM -0800, 梁辰晔 (Liang Chenye) wrote:

Conflicts detected, other wise LGTM

Rebased onto the current master with f633ad22a3cb43.

@Mashimiao
Copy link

There is an error, please refer to travis-ci log

@wking
Copy link
Contributor Author

wking commented Nov 23, 2016

On Tue, Nov 22, 2016 at 05:12:11PM -0800, Ma Shimiao wrote:

There is an error, please refer to travis-ci
log

Oops, thanks. Fixed with 2a3cb436815c45.

@Mashimiao
Copy link

need another rebase

@wking
Copy link
Contributor Author

wking commented Nov 23, 2016

On Tue, Nov 22, 2016 at 09:32:12PM -0800, Ma Shimiao wrote:

need another rebase

Rebased again with 6815c45a0fe802.

@Mashimiao
Copy link

Mashimiao commented Nov 23, 2016

LGTM

Approved with PullApprove

@Mashimiao
Copy link

@wking need another rebase

@wking wking force-pushed the public-config branch 2 times, most recently from 5ce5e35 to 986f514 Compare February 14, 2017 19:43
@wking
Copy link
Contributor Author

wking commented Feb 14, 2017 via email

@Mashimiao
Copy link

Mashimiao commented Feb 17, 2017

LGTM

Approved with PullApprove

@Mashimiao Mashimiao modified the milestone: 0.6 Apr 11, 2017
@Mashimiao Mashimiao removed this from the 0.6 milestone Aug 2, 2017
@Mashimiao Mashimiao added this to the v0.6.0 milestone Sep 26, 2017
@zhouhao3
Copy link

Need rebase.

@wking
Copy link
Contributor Author

wking commented Oct 23, 2017

Need rebase.

This one is a pain to rebase ;). It's milestoned 0.6.0 now, so it's probably better to just wait and rebaae after 0.5.0 is cut and we have a better chance of collecting two LGTMs before it goes stale again ;).

@zhouhao3
Copy link

zhouhao3 commented Mar 6, 2018

@wking It's already 0.5, please update.

@wking
Copy link
Contributor Author

wking commented Apr 11, 2018

This is going to conflict with #194, so I'll wait and rebase this one after that settles.

This makes the attribute public, since quite a few config
manipulations are easier using Go's types than they are via
getter/setter/mutator methods.  This also means that we can drop
methods that are more awkward than direct access (although we'll want
to keep methods that are more convenient than direct access).  I
haven't done any method-dropping in this commit though, although I
have deprecated a few of the more redundant methods.  I'd called for
this back when we started adding these methods [1], and Mrunal was
sounding more positive about the public-attribute approach a few weeks
ago [2].

I've also renamed this from "spec" to "config", because it is a
config.  I'm not sure why runtime-spec decided to call the main
config.go type 'Spec' [3], but I don't think we should repeat that
idiosyncrasy.

[1]: opencontainers#137 (comment)
[2]: opencontainers#253 (comment)
[3]: https://github.com/opencontainers/runtime-spec/blob/v1.0.0-rc2/specs-go/config.go#L6

Signed-off-by: W. Trevor King <wking@tremily.us>
@wking
Copy link
Contributor Author

wking commented Apr 12, 2018

With #194 landed, I've rebased this onto master with 986f51484a62c6.

@zhouhao3
Copy link

zhouhao3 commented Apr 12, 2018

LGTM

Approved with PullApprove

@zhouhao3 zhouhao3 merged commit 1736729 into opencontainers:master Apr 12, 2018
@wking wking deleted the public-config branch April 18, 2018 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants