Files
scylla/locator/simple_snitch.hh
Pavel Emelyanov 26f9472f21 snitch: Mark get_datacenter/_rack methods const
They are in fact such, but wasn't marked as const before because they
wanted to talk to non-const gossiper and system_keyspaces methods and
updated snitch internal caches

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

46 lines
974 B
C++

/*
*
* Modified by ScyllaDB
* Copyright (C) 2015-present ScyllaDB
*/
/*
* SPDX-License-Identifier: (AGPL-3.0-or-later and Apache-2.0)
*/
#pragma once
#include "snitch_base.hh"
#include "utils/fb_utilities.hh"
#include <memory>
namespace locator {
/**
* A simple endpoint snitch implementation that treats Strategy order as
* proximity, allowing non-read-repaired reads to prefer a single endpoint,
* which improves cache locality.
*/
struct simple_snitch : public snitch_base {
simple_snitch(const snitch_config& cfg) {
_my_dc = get_datacenter();
_my_rack = get_rack();
// This snitch is ready on creation
set_snitch_ready();
}
virtual sstring get_rack() const override {
return "rack1";
}
virtual sstring get_datacenter() const override {
return "datacenter1";
}
virtual sstring get_name() const override {
return "org.apache.cassandra.locator.SimpleSnitch";
}
};
}