aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Common/ExternalLoaderStatus.h
blob: ff0758fd3b22b5f553bf219e0c811243d0c68871 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#pragma once

#include <vector>
#include <base/EnumReflection.h>
#include <base/types.h>

namespace DB
{
    enum class ExternalLoaderStatus : Int8
    {
        NOT_LOADED, /// Object hasn't been tried to load. This is an initial state.
        LOADED, /// Object has been loaded successfully.
        FAILED, /// Object has been failed to load.
        LOADING, /// Object is being loaded right now for the first time.
        FAILED_AND_RELOADING, /// Object was failed to load before and it's being reloaded right now.
        LOADED_AND_RELOADING, /// Object was loaded successfully before and it's being reloaded right now.
        NOT_EXIST, /// Object with this name wasn't found in the configuration.
    };

    inline std::vector<std::pair<String, Int8>> getStatusEnumAllPossibleValues()
    {
        std::vector<std::pair<String, Int8>> out;
        out.reserve(magic_enum::enum_count<ExternalLoaderStatus>());

        for (const auto & [value, str] : magic_enum::enum_entries<ExternalLoaderStatus>())
            out.emplace_back(std::string{str}, static_cast<Int8>(value));

        return out;
    }
}