Add implementation of Paxos algrithm used by monitor.

Signed-off-by: Shaoxin Cheng <chengshaoxin@gmail.com>