ClickHouse/dbms/Common/StatusInfo.h
Ivan 97f2a2213e
Move all folders inside /dbms one level up (#9974)
* Move some code outside dbms/src folder
* Fix paths
2020-04-02 02:51:21 +03:00

38 lines
840 B
C++

#pragma once
#include <stddef.h>
#include <cstdint>
#include <utility>
#include <atomic>
#include <Core/Types.h>
#include <mutex>
#include <unordered_map>
namespace CurrentStatusInfo
{
using Status = size_t;
using Key = std::string;
const char * getName(Status event);
const char * getDocumentation(Status event);
const std::vector<std::pair<String, Int8>> & getAllPossibleValues(Status event);
extern std::unordered_map<String, Int8> values[];
extern std::mutex locks[];
Status end();
inline void set(Status status, Key key, Int8 value)
{
std::lock_guard<std::mutex> lock(locks[status]);
values[status][key] = value;
}
inline void unset(Status status, Key key)
{
std::lock_guard<std::mutex> lock(locks[status]);
values[status].erase(key);
}
}