aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Disks/DiskLocalCheckThread.h
blob: eb688d599ca0b921b9d828a2512ef8c528462b92 (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
31
32
33
34
35
36
37
38
39
#pragma once

#include <Core/BackgroundSchedulePool.h>
#include <Interpreters/Context_fwd.h>

namespace Poco
{
class Logger;
}

namespace DB
{
class DiskLocal;

class DiskLocalCheckThread : WithContext
{
public:
    friend class DiskLocal;

    DiskLocalCheckThread(DiskLocal * disk_, ContextPtr context_, UInt64 local_disk_check_period_ms);

    void startup();

    void shutdown();

private:
    bool check();
    void run();

    DiskLocal * disk;
    size_t check_period_ms;
    Poco::Logger * log;
    std::atomic<bool> need_stop{false};

    BackgroundSchedulePool::TaskHolder task;
    size_t retry{};
};

}