| 595 | |
| 596 | |
| 597 | Future<bool> LogStorageProcess::__expunge(const Entry& entry) |
| 598 | { |
| 599 | Option<Snapshot> snapshot = snapshots.get(entry.name()); |
| 600 | |
| 601 | if (snapshot.isNone()) { |
| 602 | return false; |
| 603 | } |
| 604 | |
| 605 | // Check the version first. |
| 606 | if (id::UUID::fromBytes(snapshot->entry.uuid()).get() != |
| 607 | id::UUID::fromBytes(entry.uuid()).get()) { |
| 608 | return false; |
| 609 | } |
| 610 | |
| 611 | // Now serialize and append an expunge operation. |
| 612 | Operation operation; |
| 613 | operation.set_type(Operation::EXPUNGE); |
| 614 | operation.mutable_expunge()->set_name(entry.name()); |
| 615 | |
| 616 | string value; |
| 617 | if (!operation.SerializeToString(&value)) { |
| 618 | return Failure("Failed to serialize Operation"); |
| 619 | } |
| 620 | |
| 621 | return writer.append(value) |
| 622 | .then(defer(self(), &Self::___expunge, entry, lambda::_1)); |
| 623 | } |
| 624 | |
| 625 | |
| 626 | Future<bool> LogStorageProcess::___expunge( |