|
4 | 4 |
|
5 | 5 | #include "Cluster.hxx" |
6 | 6 | #include "ClusterConfig.hxx" |
7 | | -#include "MemberHash.hxx" |
8 | 7 | #include "Context.hxx" |
9 | 8 | #include "MonitorStock.hxx" |
10 | 9 | #include "MonitorRef.hxx" |
@@ -68,9 +67,6 @@ CalculateStickyHash(std::span<const std::byte> source) noexcept |
68 | 67 |
|
69 | 68 | #ifdef HAVE_AVAHI |
70 | 69 |
|
71 | | -class LbCluster::StickyRing final |
72 | | - : public MemberHashRing<ZeroconfMemberMap::iterator> {}; |
73 | | - |
74 | 70 | class LbCluster::ZeroconfMember final : LeakDetector { |
75 | 71 | InetAddress address; |
76 | 72 |
|
@@ -424,29 +420,6 @@ LbCluster::PickNextGoodZeroconf(const Expiry now) noexcept |
424 | 420 | false); |
425 | 421 | } |
426 | 422 |
|
427 | | -inline LbCluster::ZeroconfMemberMap::const_reference |
428 | | -LbCluster::PickZeroconfHashRing(Expiry now, |
429 | | - sticky_hash_t sticky_hash) noexcept |
430 | | -{ |
431 | | - assert(!active_zeroconf_members.empty()); |
432 | | - assert(sticky_ring != nullptr); |
433 | | - |
434 | | - auto i = sticky_ring->Pick(sticky_hash); |
435 | | - assert(i != zeroconf_members.end()); |
436 | | - |
437 | | - unsigned retries = active_zeroconf_members.size(); |
438 | | - while (true) { |
439 | | - if (--retries == 0 || |
440 | | - i->second.GetFailureInfo().Check(now)) |
441 | | - return *i; |
442 | | - |
443 | | - /* the node is known-bad; pick the next one in the ring */ |
444 | | - const auto next = sticky_ring->FindNext(sticky_hash); |
445 | | - sticky_hash = next.first; |
446 | | - i = next.second; |
447 | | - } |
448 | | -} |
449 | | - |
450 | 423 | inline LbCluster::ZeroconfMemberMap::const_reference |
451 | 424 | LbCluster::PickZeroconfRendezvous(Expiry now, const Arch arch, |
452 | 425 | std::span<const std::byte> sticky_source) noexcept |
@@ -527,9 +500,6 @@ LbCluster::PickZeroconf(const Expiry now, Arch arch, |
527 | 500 | assert(config.sticky_mode != StickyMode::NONE); |
528 | 501 |
|
529 | 502 | switch (config.sticky_method) { |
530 | | - case LbClusterConfig::StickyMethod::CONSISTENT_HASHING: |
531 | | - return &PickZeroconfHashRing(now, sticky_hash); |
532 | | - |
533 | 503 | case LbClusterConfig::StickyMethod::RENDEZVOUS_HASHING: |
534 | 504 | return &PickZeroconfRendezvous(now, arch, sticky_source); |
535 | 505 |
|
@@ -563,24 +533,6 @@ LbCluster::FillActive() noexcept |
563 | 533 |
|
564 | 534 | for (auto i = zeroconf_members.begin(); i != zeroconf_members.end(); ++i) |
565 | 535 | active_zeroconf_members.push_back(i); |
566 | | - |
567 | | - switch (config.sticky_method) { |
568 | | - case LbClusterConfig::StickyMethod::CONSISTENT_HASHING: |
569 | | - if (sticky_ring == nullptr) |
570 | | - /* lazy allocation */ |
571 | | - sticky_ring = std::make_unique<StickyRing>(); |
572 | | - |
573 | | - BuildMemberHashRing(*sticky_ring, active_zeroconf_members, |
574 | | - [](ZeroconfMemberMap::const_iterator member) noexcept { |
575 | | - return member->second.GetAddress(); |
576 | | - }); |
577 | | - |
578 | | - break; |
579 | | - |
580 | | - case LbClusterConfig::StickyMethod::RENDEZVOUS_HASHING: |
581 | | - case LbClusterConfig::StickyMethod::CACHE: |
582 | | - break; |
583 | | - } |
584 | 536 | } |
585 | 537 |
|
586 | 538 | class LbCluster::ZeroconfHttpConnect final : StockGetHandler, Lease, Cancellable { |
|
0 commit comments