| 515 | |
| 516 | |
| 517 | void RegistrarProcess::_update( |
| 518 | const Future<Option<Variable>>& store, |
| 519 | const Owned<Registry>& updatedRegistry, |
| 520 | deque<Owned<RegistryOperation>> applied) |
| 521 | { |
| 522 | updating = false; |
| 523 | |
| 524 | // Abort if the storage operation did not succeed. |
| 525 | if (!store.isReady() || store->isNone()) { |
| 526 | string message = "Failed to update registry: "; |
| 527 | |
| 528 | if (store.isFailed()) { |
| 529 | message += store.failure(); |
| 530 | } else if (store.isDiscarded()) { |
| 531 | message += "discarded"; |
| 532 | } else { |
| 533 | message += "version mismatch"; |
| 534 | } |
| 535 | |
| 536 | fail(&applied, message); |
| 537 | abort(message); |
| 538 | |
| 539 | return; |
| 540 | } |
| 541 | |
| 542 | Duration elapsed = metrics.state_store.stop(); |
| 543 | |
| 544 | LOG(INFO) << "Successfully updated the registry in " << elapsed; |
| 545 | |
| 546 | variable = store->get(); |
| 547 | registry->Swap(updatedRegistry.get()); |
| 548 | |
| 549 | // Remove the operations. |
| 550 | while (!applied.empty()) { |
| 551 | Owned<RegistryOperation> operation = applied.front(); |
| 552 | applied.pop_front(); |
| 553 | |
| 554 | operation->set(); |
| 555 | } |
| 556 | |
| 557 | if (!operations.empty()) { |
| 558 | update(); |
| 559 | } |
| 560 | } |
| 561 | |
| 562 | |
| 563 | void RegistrarProcess::abort(const string& message) |
nothing calls this directly
no test coverage detected