| 592 | |
| 593 | |
| 594 | Future<Option<Log::Position>> LogWriterProcess::truncate( |
| 595 | const Log::Position& to) |
| 596 | { |
| 597 | VLOG(1) << "Attempting to truncate the log to " << to.value; |
| 598 | |
| 599 | if (coordinator == nullptr) { |
| 600 | return Failure("No election has been performed"); |
| 601 | } |
| 602 | |
| 603 | if (error.isSome()) { |
| 604 | return Failure(error.get()); |
| 605 | } |
| 606 | |
| 607 | return coordinator->truncate(to.value) |
| 608 | .then(lambda::bind(&Self::position, lambda::_1)) |
| 609 | .onFailed(defer(self(), &Self::failed, "Failed to truncate", lambda::_1)); |
| 610 | } |
| 611 | |
| 612 | |
| 613 | Option<Log::Position> LogWriterProcess::position( |