snitch: Introduce and use get_location() method

There are some places out there that generate locator::endpoint_dc_rack
pair out of snitch's get_datacenter() and get_rack() calls. Generalize
those with snitch's new method. It will also be used by next patch.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
This commit is contained in:
Pavel Emelyanov
2023-09-05 11:29:00 +03:00
parent 153607d587
commit d2bd203cba
3 changed files with 10 additions and 7 deletions

View File

@@ -15,6 +15,7 @@
#include <boost/signals2.hpp>
#include <boost/signals2/dummy_mutex.hpp>
#include "locator/types.hh"
#include "gms/inet_address.hh"
#include "inet_address_vectors.hh"
#include "gms/versioned_value.hh"
@@ -70,6 +71,13 @@ public:
*/
virtual sstring get_datacenter() const = 0;
locator::endpoint_dc_rack get_location() const {
return locator::endpoint_dc_rack{
.dc = get_datacenter(),
.rack = get_rack(),
};
}
/**
* returns whatever info snitch wants to gossip
*/