| 574 | |
| 575 | |
| 576 | Future<Option<Log::Position>> LogWriterProcess::append(const string& bytes) |
| 577 | { |
| 578 | VLOG(1) << "Attempting to append " << bytes.size() << " bytes to the log"; |
| 579 | |
| 580 | if (coordinator == nullptr) { |
| 581 | return Failure("No election has been performed"); |
| 582 | } |
| 583 | |
| 584 | if (error.isSome()) { |
| 585 | return Failure(error.get()); |
| 586 | } |
| 587 | |
| 588 | return coordinator->append(bytes) |
| 589 | .then(lambda::bind(&Self::position, lambda::_1)) |
| 590 | .onFailed(defer(self(), &Self::failed, "Failed to append", lambda::_1)); |
| 591 | } |
| 592 | |
| 593 | |
| 594 | Future<Option<Log::Position>> LogWriterProcess::truncate( |