the log.hh under the root of the tree was created keep the backward compatibility when seastar was extracted into a separate library. so log.hh should belong to `utils` directory, as it is based solely on seastar, and can be used all subsystems. in this change, we move log.hh into utils/log.hh to that it is more modularized. and this also improves the readability, when one see `#include "utils/log.hh"`, it is obvious that this source file needs the logging system, instead of its own log facility -- please note, we do have two other `log.hh` in the tree. Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
39 lines
998 B
C++
39 lines
998 B
C++
/*
|
|
*
|
|
* Modified by ScyllaDB
|
|
* Copyright (C) 2015-present ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: (AGPL-3.0-or-later and Apache-2.0)
|
|
*/
|
|
|
|
#include <seastar/util/modules.hh>
|
|
#include <seastar/core/shard_id.hh>
|
|
#include <seastar/core/on_internal_error.hh>
|
|
#include <seastar/core/print.hh>
|
|
#include "utils/log.hh"
|
|
#include "seastarx.hh"
|
|
#include "version_generator.hh"
|
|
|
|
namespace gms {
|
|
namespace version_generator {
|
|
// In the original Cassandra code, version was an AtomicInteger.
|
|
// For us, we run the gossiper on a single CPU, and don't need to use atomics.
|
|
static version_type version;
|
|
|
|
static logging::logger logger("version_generator");
|
|
|
|
version_type get_next_version() noexcept
|
|
{
|
|
if (this_shard_id() != 0) [[unlikely]] {
|
|
on_fatal_internal_error(logger, format(
|
|
"{} can only be called on shard 0, but it was called on shard {}",
|
|
__FUNCTION__, this_shard_id()));
|
|
}
|
|
return ++version;
|
|
}
|
|
|
|
} // namespace version_generator
|
|
} // namespace gms
|