| 129 | } |
| 130 | |
| 131 | void start() |
| 132 | { |
| 133 | VLOG(2) << "Starting to wait for enough quorum of replicas before running " |
| 134 | << "recovery protocol, expected quroum size: " << stringify(quorum); |
| 135 | |
| 136 | // Wait until there are enough (i.e., quorum of) replicas in the |
| 137 | // network to avoid unnecessary retries. |
| 138 | chain = network->watch(quorum, Network::GREATER_THAN_OR_EQUAL_TO) |
| 139 | .then(defer(self(), &Self::broadcast)) |
| 140 | .then(defer(self(), &Self::receive)) |
| 141 | .after(timeout, lambda::bind(&Self::timedout, lambda::_1, timeout)) |
| 142 | .onAny(defer(self(), &Self::finished, lambda::_1)); |
| 143 | } |
| 144 | |
| 145 | Future<Nothing> broadcast() |
| 146 | { |