From a0c85318756a983453feb3d8cdd0b687ab1ffd37 Mon Sep 17 00:00:00 2001 From: sylwiaszunejko Date: Fri, 22 Sep 2023 13:01:16 +0200 Subject: [PATCH] locator: add function to check if host is local --- locator/tablets.hh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/locator/tablets.hh b/locator/tablets.hh index 29abb4edb5..b04225ee2f 100644 --- a/locator/tablets.hh +++ b/locator/tablets.hh @@ -114,6 +114,16 @@ tablet_replica_set replace_replica(const tablet_replica_set& rs, tablet_replica return result; } +inline +bool contains(const tablet_replica_set& rs, host_id host) { + for (auto replica : rs) { + if (replica.host == host) { + return true; + } + } + return false; +} + /// Stores information about a single tablet. struct tablet_info { tablet_replica_set replicas;