| 324 | |
| 325 | |
| 326 | Future<Option<uint64_t>> CoordinatorProcess::truncate(uint64_t to) |
| 327 | { |
| 328 | if (state == INITIAL || state == ELECTING) { |
| 329 | return None(); |
| 330 | } else if (state == WRITING) { |
| 331 | return Failure("Coordinator is currently writing"); |
| 332 | } |
| 333 | |
| 334 | Action action; |
| 335 | action.set_position(index); |
| 336 | action.set_promised(proposal); |
| 337 | action.set_performed(proposal); |
| 338 | action.set_type(Action::TRUNCATE); |
| 339 | Action::Truncate* truncate = action.mutable_truncate(); |
| 340 | truncate->set_to(to); |
| 341 | |
| 342 | return write(action); |
| 343 | } |
| 344 | |
| 345 | |
| 346 | Future<Option<uint64_t>> CoordinatorProcess::write(const Action& action) |