DDLWorker.h 720 字节
Newer Older
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 40
#pragma once

#include <Interpreters/Context.h>
#include <common/logger_useful.h>

#include <atomic>
#include <chrono>
#include <condition_variable>
#include <mutex>
#include <thread>

namespace DB
{

class DDLWorker
{
public:
    DDLWorker(const Poco::Util::AbstractConfiguration & config,
              const std::string & config_name, Context & context_);
    ~DDLWorker();

private:
    void processTasks();
    void processCreate(const std::string & path);

    void run();

private:
    Context & context;
    Logger * log = &Logger::get("DDLWorker");

    std::string host_task_queue_path;

    std::atomic<bool> stop_flag;
    std::condition_variable cond_var;
    std::mutex lock;
    std::thread thread;
};

}