ClickHouse/dbms/src/Storages/MergeTree/RemotePartChecker.h

55 lines
1.2 KiB
C++
Raw Normal View History

2016-03-25 11:48:45 +00:00
#pragma once
#include <Interpreters/InterserverIOHandler.h>
#include <Storages/MergeTree/MergeTreeData.h>
#include <IO/WriteBuffer.h>
#include <Core/Types.h>
2016-03-25 11:48:45 +00:00
#include <common/logger_useful.h>
namespace DB
{
namespace RemotePartChecker
{
enum class Status : UInt8
{
OK = 0,
NOT_FOUND,
INCONSISTENT,
ERROR
2016-03-25 11:48:45 +00:00
};
class Service final : public InterserverIOEndpoint
{
public:
Service(StoragePtr & storage_);
Service(const Service &) = delete;
Service & operator=(const Service &) = delete;
std::string getId(const std::string & node_id) const override;
void processQuery(const Poco::Net::HTMLForm & params, ReadBuffer & body, WriteBuffer & out, Poco::Net::HTTPServerResponse & response) override;
2016-03-25 11:48:45 +00:00
private:
StoragePtr owned_storage;
MergeTreeData & data;
Logger * log = &Logger::get("RemotePartChecker::Service");
2016-03-25 11:48:45 +00:00
};
class Client final
{
public:
Client() = default;
Client(const Client &) = delete;
Client & operator=(const Client &) = delete;
2016-03-25 11:48:45 +00:00
Status check(const std::string & part_name, const std::string & hash,
const InterserverIOEndpointLocation & to_location);
2016-03-25 11:48:45 +00:00
private:
// Logger * log = &Logger::get("RemotePartChecker::Client");
2016-03-25 11:48:45 +00:00
};
}
}