open question: should the methods on juju.Conn take a string or a type
roger peppe
roger.peppe at canonical.com
Tue Aug 7 13:28:40 UTC 2012
I agree with Gustavo's sentiments. I thrashed through this issue
when doing the recent deploy changes to Conn, and we decided
that State was deliberately *not* hidden behind Conn
(hence the AddService method which returns a *state.Service).
I think to make things a little easier when using a Conn,
we could have methods on Conn that convert from strings
to the respective state type.
For instance:
// Service returns the service with the given name.
func (c *Conn) Service(name string) (*state.Service, error)
This has two advantages:
1) It makes the code slightly smaller in the command implementations.
2) It makes it obvious that state.Service is "blessed" with respect
to the Conn type - that you are expected to deal with the underlying
state.Service to get things done.
Reasonable?
More information about the Juju-dev
mailing list