state: infrastructure for synchronising state server upgrades

Introduce a new UpgradeInfo struct (and underlying mongo document) which will be used by state servers to synchronise tools upgrades.

Later commits will integrate this infrastructure with the upgrade machinery in jujud.

William Reade and Menno Smits both contributed to this revision.
I'm not sure I agree because what you suggest changes behaviour slightly. There's no guarantee that out will be nil if the iterator reports an error.