WIP: Add election framework to master; publish services.

Needs tests still.
This seems like something that could be encapsulated into a separate object with an interface to invoke when master is lost/gained.  It might not be cleaner, but everything here feels like it's generic to all masters.