rocksdb/db/write_stall_stats.h
Peter Dillinger 4e60663b31 Remove unnecessary, confusing 'extern' (#12300)
Summary:
In C++, `extern` is redundant in a number of cases:
* "Global" function declarations and definitions
* "Global" variable definitions when already declared `extern`

For consistency and simplicity, I've removed these in code that *we own*. In a couple of cases, I removed obsolete declarations, and for MagicNumber constants, I have consolidated the declarations into a header file (format.h)
as standard best practice would prescribe.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/12300

Test Plan: no functional changes, CI

Reviewed By: ajkr

Differential Revision: D53148629

Pulled By: pdillinger

fbshipit-source-id: fb8d927959892e03af09b0c0d542b0a3b38fd886
2024-01-29 10:38:08 -08:00

48 lines
1.6 KiB
C++

// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
// This source code is licensed under both the GPLv2 (found in the
// COPYING file in the root directory) and Apache 2.0 License
// (found in the LICENSE.Apache file in the root directory).
#pragma once
#include <array>
#include "db/internal_stats.h"
#include "rocksdb/types.h"
namespace ROCKSDB_NAMESPACE {
const std::string& InvalidWriteStallHyphenString();
const std::string& WriteStallCauseToHyphenString(WriteStallCause cause);
const std::string& WriteStallConditionToHyphenString(
WriteStallCondition condition);
// REQUIRES:
// cause` is CF-scope `WriteStallCause`, see `WriteStallCause` for more
//
// REQUIRES:
// `condition` != `WriteStallCondition::kNormal`
InternalStats::InternalCFStatsType InternalCFStat(
WriteStallCause cause, WriteStallCondition condition);
// REQUIRES:
// cause` is DB-scope `WriteStallCause`, see `WriteStallCause` for more
//
// REQUIRES:
// `condition` != `WriteStallCondition::kNormal`
InternalStats::InternalDBStatsType InternalDBStat(
WriteStallCause cause, WriteStallCondition condition);
bool isCFScopeWriteStallCause(WriteStallCause cause);
bool isDBScopeWriteStallCause(WriteStallCause cause);
constexpr uint32_t kNumCFScopeWriteStallCauses =
static_cast<uint32_t>(WriteStallCause::kCFScopeWriteStallCauseEnumMax) -
static_cast<uint32_t>(WriteStallCause::kMemtableLimit);
constexpr uint32_t kNumDBScopeWriteStallCauses =
static_cast<uint32_t>(WriteStallCause::kDBScopeWriteStallCauseEnumMax) -
static_cast<uint32_t>(WriteStallCause::kWriteBufferManagerLimit);
} // namespace ROCKSDB_NAMESPACE