-
Notifications
You must be signed in to change notification settings - Fork 141
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
Add resource set funcs into generate library #137
Conversation
Signed-off-by: Haiyan Meng <hmeng@redhat.com>
@mrunalp , PTAL. I plan to expand the ocitools generate command arguments in a separate issue and PR. |
LGTM |
I'm too late to beat the merge here, but do we really prefer these
one-line setters to:
type Generator struct {
Spec *rspec.Spec
}
and letting folks touch g.Spec directly?
|
@wking Good point and I have thought about it and gone back and forth. |
@mrunalp , @wking , I indeed felt the pain when I tried to add some func like |
On Thu, Jul 21, 2016 at 01:57:41PM -0700, Mrunal Patel wrote:
Just make the spec public 1. No need for a getter unless you want |
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 [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>
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 [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>
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 [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>
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 [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>
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 [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>
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 [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>
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>
The PR adds functions setting the linux resource cpu and memory fields into the generate library.
Signed-off-by: Haiyan Meng hmeng@redhat.com