Help needed for the API

John Arbash Meinel john at arbash-meinel.com
Tue Sep 3 04:51:22 UTC 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2013-09-03 8:28, Tim Penhey wrote:
> Hi folks,
> 
> I'm hoping someone can help point me to the right bits of the API.
> I have to admit to being lost looking at the code under state/api.
> 
> I'm wanting to have a worker that gets notified when the
> environment config changes in state, and I want to write another
> api call to request the logging info for a particular machine.  To
> me there is no obvious place to put this, nor can I see how to set
> up a simple environment config watcher.

We currently have state.WatchForEnvironConfigChanges as the actual
functional watcher against state.

The only place in the API it is exposed is:

  state/api/upgrader/Upgrader.WatchAPIVersion

Obviously we aren't committing that WatchAPIVersion will always
trigger on any EnvironConfig change, though it does today.

So I would recommend adding an API that maps closely to what you want:
 state/api/?/WatchLoggingConfigChanges (label it what you will)
and a matching
 state/api/?/LoggingConfig(entities)

The watcher would be a regular NotifyWatcher. This probably will exist
in "common" and then be exposed in a couple of facades. (so you would
add one API call for unit agents, and a different one for machine agents.)

Right now the API is pretty laid out based on tasks rather than based
on agents. So something like logging might need to be exposed for
every task? It would make it pretty obvious that you could increase
the verbosity for the Upgrader code without affecting the verbosity of
the Uniter (and vice versa). But I don't know if you have logging
configured easily that way. I'm guessing you do it more as an "agent
has this logging configuration which spans all the tasks the agent
works on".


> 
> Perhaps someone can either explain or point me to the
> documentation around the design philosophy for the API, both as a
> client using the API and how it talks internally to state.
> 
> Cheers, Tim
> 

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (Cygwin)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlIlasoACgkQJdeBCYSNAAP/0wCfUrpC7FtlsWN9duB+K1ZkbzLg
w08An1Sq1mIcwhO6k6e+bwM4y1Jjcitd
=W4YP
-----END PGP SIGNATURE-----



More information about the Juju-dev mailing list