registry: remove LegacyJobPayload compatibility tricks
agent: change unit state publishing model

This establishes N goroutines (I suggest 5, but it could be 1 to keep
closer to the existing behaviour) which are solely responsible for
publishing to the Registry. These goroutines are select()ing on a
queue channel, where each item (string) indicates that they should
publish a UnitState corresponding to that name.

They retrieve this UnitState from a name->state mapping which only ever
contains the _latest_ UnitState for a particular name.

- The former publishAll() will now simply trigger a publishing of every
  UnitState in the cache and update every UnitState in the mapping
- Any updates from the UnitStateGenerator will result in a trigger event
  and update the latest UnitState in the mapping
agent: fix up mutexes (mutices?)
agent: add simple tests to unit state publisher
pkg: add Clock interface, and fakeClock for testing
pkg: update reconciler to use Clock interface
pkg: fix race in fakeClock and expose Tick

Also fixes the PeriodicReconciler's initial reconcile
agent: switch UnitStatePublisher to Clock interface
agent: abstract out publisher function

This changes the agent UnitStatePublisher to accept a publish function
instead of always depending on the registry. In combination with the new
pkg.Clock interface, this makes it easier to test the time-dependent
behaviour of the UnitStatePublisher.

pkg.FakeClock is now exported to facilitate testing.
agent: test after stopping UnitStatePublisher too
pkg: fix typo in clock docstring
agent: expand test coverage of UnitStatePublisher, fix clock
scripts: remove superfluous install in test script
Merge pull request #886 from jonboulle/test

scripts: remove superfluous install in test script
Merge pull request #739 from jonboulle/remove_legacy_payload

Remove legacy job payload code
api: add unit name validation
Merge pull request #867 from jonboulle/validate_unit_names

API should validate unit names
Merge pull request #883 from jonboulle/rework_usp_redux

agent: rework UnitStatePublisher with complete coverage