open question: should the methods on juju.Conn take a string or a type

Gustavo Niemeyer gustavo at niemeyer.net
Tue Aug 7 12:27:37 UTC 2012


On Tue, Aug 7, 2012 at 1:15 PM, William Reade
<william.reade at canonical.com> wrote:
> On Tue, 2012-08-07 at 21:49 +1000, David Cheney wrote:
>> Maybe as a proof of concept I should try removing conn.State() from the public API, and move it into export_test, and see what breaks.
>
> Hmm, but on reading niemeyer's reviews, it does look like I have not
> correctly understood the intent :(. Sorry noise.

To be honest, I think we're mostly in agreement regarding intent
there. Conn is a facade for interacting with State and Environ in a
pleasant way from code, and that in part matches the functionality
offered by the command line tools.

At the same time, adding methods like conn.Service that match
precisely what state.Service returns feels like spinning wheels
unnecessarily at the moment. I also disagree with the idea of having
service names rather than properly typed service values. We don't want
to be converting back and forth between type and name when using our
own APIs, nor do we want to be converting from name to type on every
single method that takes a service as an argument in Conn. Types are
also nice both for documentation and static verifications, in cases
like this.

I hope this clarifies the situation a bit. Aren't we mostly aligned?


gustavo @ http://niemeyer.net



More information about the Juju-dev mailing list