2016-03-25 11:48:45 +00:00
|
|
|
#pragma once
|
|
|
|
|
2017-04-01 09:19:00 +00:00
|
|
|
#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
|
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
OK = 0,
|
|
|
|
NOT_FOUND,
|
|
|
|
INCONSISTENT,
|
|
|
|
ERROR
|
2016-03-25 11:48:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class Service final : public InterserverIOEndpoint
|
|
|
|
{
|
|
|
|
public:
|
2017-04-01 07:20:54 +00:00
|
|
|
Service(StoragePtr & storage_);
|
|
|
|
Service(const Service &) = delete;
|
|
|
|
Service & operator=(const Service &) = delete;
|
|
|
|
std::string getId(const std::string & node_id) const override;
|
2017-04-06 13:03:23 +00:00
|
|
|
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:
|
2017-04-01 07:20:54 +00:00
|
|
|
StoragePtr owned_storage;
|
|
|
|
MergeTreeData & data;
|
|
|
|
Logger * log = &Logger::get("RemotePartChecker::Service");
|
2016-03-25 11:48:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class Client final
|
|
|
|
{
|
|
|
|
public:
|
2017-04-01 07:20:54 +00:00
|
|
|
Client() = default;
|
|
|
|
Client(const Client &) = delete;
|
|
|
|
Client & operator=(const Client &) = delete;
|
2016-03-25 11:48:45 +00:00
|
|
|
|
2017-04-01 07:20:54 +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:
|
2017-04-01 07:20:54 +00:00
|
|
|
// Logger * log = &Logger::get("RemotePartChecker::Client");
|
2016-03-25 11:48:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|