| 481 | |
| 482 | private: |
| 483 | void watched(const Future<size_t>& future) |
| 484 | { |
| 485 | if (!future.isReady()) { |
| 486 | promise.fail( |
| 487 | future.isFailed() ? |
| 488 | future.failure() : |
| 489 | "Not expecting discarded future"); |
| 490 | |
| 491 | terminate(self()); |
| 492 | return; |
| 493 | } |
| 494 | |
| 495 | CHECK_GE(future.get(), quorum); |
| 496 | |
| 497 | request.set_proposal(proposal); |
| 498 | request.set_position(action.position()); |
| 499 | request.set_type(action.type()); |
| 500 | switch (action.type()) { |
| 501 | case Action::NOP: |
| 502 | CHECK(action.has_nop()); |
| 503 | request.mutable_nop(); |
| 504 | break; |
| 505 | case Action::APPEND: |
| 506 | CHECK(action.has_append()); |
| 507 | request.mutable_append()->CopyFrom(action.append()); |
| 508 | break; |
| 509 | case Action::TRUNCATE: |
| 510 | CHECK(action.has_truncate()); |
| 511 | request.mutable_truncate()->CopyFrom(action.truncate()); |
| 512 | break; |
| 513 | default: |
| 514 | LOG(FATAL) << "Unknown Action::Type " << action.type(); |
| 515 | } |
| 516 | |
| 517 | network->broadcast(protocol::write, request) |
| 518 | .onAny(defer(self(), &Self::broadcasted, lambda::_1)); |
| 519 | } |
| 520 | |
| 521 | void broadcasted(const Future<set<Future<WriteResponse>>>& future) |
| 522 | { |
nothing calls this directly
no test coverage detected