aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Core/ServerUUID.h
blob: 36bbf0e63153ce050b0e50d47bb5dba2ea37b1aa (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
#pragma once
#include <Core/UUID.h>
#include <filesystem>

namespace fs = std::filesystem;
namespace Poco
{
    class Logger;
}

namespace DB
{

class ServerUUID
{
    inline static UUID server_uuid = UUIDHelpers::Nil;

public:
    /// Returns persistent UUID of current clickhouse-server or clickhouse-keeper instance.
    static UUID get() { return server_uuid; }

    /// Loads server UUID from file or creates new one. Should be called on daemon startup.
    static void load(const fs::path & server_uuid_file, Poco::Logger * log);
};

}