Files
scylladb/locator/snitch_base.cc
Pavel Emelyanov 2bb354b2e7 snitch: Remove gossiper reference
It doesn't need gossiper any longer. This change will allow starting
snitch early by the next patch, and eventually improving the
token-metadata start-up sequence

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
2022-10-11 05:17:08 +03:00

39 lines
946 B
C++

/*
*
* Modified by ScyllaDB
* Copyright (C) 2015-present ScyllaDB
*/
/*
* SPDX-License-Identifier: (AGPL-3.0-or-later and Apache-2.0)
*/
#include "locator/snitch_base.hh"
#include "gms/application_state.hh"
namespace locator {
std::list<std::pair<gms::application_state, gms::versioned_value>> snitch_base::get_app_states() const {
return {
{gms::application_state::DC, gms::versioned_value::datacenter(_my_dc)},
{gms::application_state::RACK, gms::versioned_value::rack(_my_rack)},
};
}
snitch_ptr::snitch_ptr(const snitch_config cfg)
{
i_endpoint_snitch::ptr_type s;
try {
s = create_object<i_endpoint_snitch>(cfg.name, cfg);
} catch (no_such_class& e) {
i_endpoint_snitch::logger().error("Can't create snitch {}: not supported", cfg.name);
throw;
} catch (...) {
throw;
}
s->set_backreference(*this);
_ptr = std::move(s);
}
} // namespace locator