I got interested in building something like this when I saw Docker issue 410[1]. If my understanding is correct Mesos uses Zookeeper to keep a Mesos master available. Zab, Zookeeper's distributed consensus algorithm, is similar to Raft which has a popular Go implementation[2] written by Ben Johnson. Perhaps Flynn agents can use this implementation.
1. https://github.com/dotcloud/docker/issues/410
2. https://github.com/benbjohnson/go-raft