| 417 | } |
| 418 | |
| 419 | StatusArray DatabaseConfiguration::getRegionJSON() const { |
| 420 | StatusArray regionArr; |
| 421 | for (auto& r : regions) { |
| 422 | StatusObject regionObj; |
| 423 | StatusArray dcArr; |
| 424 | StatusObject dcObj; |
| 425 | dcObj["id"] = r.dcId.toString(); |
| 426 | dcObj["priority"] = r.priority; |
| 427 | dcArr.push_back(dcObj); |
| 428 | |
| 429 | if (r.satelliteTLogReplicationFactor == 1 && r.satelliteTLogUsableDcs == 1 && |
| 430 | r.satelliteTLogWriteAntiQuorum == 0 && r.satelliteTLogUsableDcsFallback == 0) { |
| 431 | regionObj["satellite_redundancy_mode"] = "one_satellite_single"; |
| 432 | } else if (r.satelliteTLogReplicationFactor == 2 && r.satelliteTLogUsableDcs == 1 && |
| 433 | r.satelliteTLogWriteAntiQuorum == 0 && r.satelliteTLogUsableDcsFallback == 0) { |
| 434 | regionObj["satellite_redundancy_mode"] = "one_satellite_double"; |
| 435 | } else if (r.satelliteTLogReplicationFactor == 3 && r.satelliteTLogUsableDcs == 1 && |
| 436 | r.satelliteTLogWriteAntiQuorum == 0 && r.satelliteTLogUsableDcsFallback == 0) { |
| 437 | regionObj["satellite_redundancy_mode"] = "one_satellite_triple"; |
| 438 | } else if (r.satelliteTLogReplicationFactor == 4 && r.satelliteTLogUsableDcs == 2 && |
| 439 | r.satelliteTLogWriteAntiQuorum == 0 && r.satelliteTLogUsableDcsFallback == 1 && |
| 440 | r.satelliteTLogReplicationFactorFallback == 2 && r.satelliteTLogWriteAntiQuorumFallback == 0) { |
| 441 | regionObj["satellite_redundancy_mode"] = "two_satellite_safe"; |
| 442 | } else if (r.satelliteTLogReplicationFactor == 4 && r.satelliteTLogUsableDcs == 2 && |
| 443 | r.satelliteTLogWriteAntiQuorum == 2 && r.satelliteTLogUsableDcsFallback == 1 && |
| 444 | r.satelliteTLogReplicationFactorFallback == 2 && r.satelliteTLogWriteAntiQuorumFallback == 0) { |
| 445 | regionObj["satellite_redundancy_mode"] = "two_satellite_fast"; |
| 446 | } else if (r.satelliteTLogReplicationFactor != 0) { |
| 447 | regionObj["satellite_log_replicas"] = r.satelliteTLogReplicationFactor; |
| 448 | regionObj["satellite_usable_dcs"] = r.satelliteTLogUsableDcs; |
| 449 | regionObj["satellite_anti_quorum"] = r.satelliteTLogWriteAntiQuorum; |
| 450 | if (r.satelliteTLogPolicy) |
| 451 | regionObj["satellite_log_policy"] = r.satelliteTLogPolicy->info(); |
| 452 | regionObj["satellite_log_replicas_fallback"] = r.satelliteTLogReplicationFactorFallback; |
| 453 | regionObj["satellite_usable_dcs_fallback"] = r.satelliteTLogUsableDcsFallback; |
| 454 | regionObj["satellite_anti_quorum_fallback"] = r.satelliteTLogWriteAntiQuorumFallback; |
| 455 | if (r.satelliteTLogPolicyFallback) |
| 456 | regionObj["satellite_log_policy_fallback"] = r.satelliteTLogPolicyFallback->info(); |
| 457 | } |
| 458 | |
| 459 | if (r.satelliteDesiredTLogCount != -1) { |
| 460 | regionObj["satellite_logs"] = r.satelliteDesiredTLogCount; |
| 461 | } |
| 462 | |
| 463 | if (r.satellites.size()) { |
| 464 | for (auto& s : r.satellites) { |
| 465 | StatusObject satObj; |
| 466 | satObj["id"] = s.dcId.toString(); |
| 467 | satObj["priority"] = s.priority; |
| 468 | satObj["satellite"] = 1; |
| 469 | if (s.satelliteDesiredTLogCount != -1) { |
| 470 | satObj["satellite_logs"] = s.satelliteDesiredTLogCount; |
| 471 | } |
| 472 | |
| 473 | dcArr.push_back(satObj); |
| 474 | } |
| 475 | } |
| 476 |
no test coverage detected