ClickHouse/src/Storages/MergeTree/RequestResponse.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

80 lines
1.6 KiB
C++
Raw Normal View History

#pragma once
2023-02-03 13:34:18 +00:00
#include <condition_variable>
#include <functional>
#include <optional>
#include <base/types.h>
#include <IO/WriteBuffer.h>
#include <IO/ReadBuffer.h>
#include <Storages/MergeTree/MarkRange.h>
2023-02-03 13:34:18 +00:00
#include <Storages/MergeTree/RangesInDataPart.h>
namespace DB
{
2023-02-03 13:34:18 +00:00
enum class CoordinationMode
{
Default,
/// For reading in order
WithOrder,
ReverseOrder
};
/// Represents a segment [left; right]
struct PartBlockRange
{
Int64 begin;
Int64 end;
bool operator==(const PartBlockRange & rhs) const
{
return begin == rhs.begin && end == rhs.end;
}
};
2023-02-03 13:34:18 +00:00
struct ParallelReadRequest
{
2023-02-03 13:34:18 +00:00
CoordinationMode mode;
size_t replica_num;
size_t min_number_of_marks;
/// Extension for ordered mode
RangesInDataPartsDescription description;
void serialize(WriteBuffer & out) const;
2023-02-03 13:34:18 +00:00
String describe() const;
void deserialize(ReadBuffer & in);
2023-02-03 13:34:18 +00:00
void merge(ParallelReadRequest & other);
};
2023-02-03 13:34:18 +00:00
struct ParallelReadResponse
{
bool finish{false};
RangesInDataPartsDescription description;
2022-11-14 06:13:42 +00:00
2023-02-03 13:34:18 +00:00
void serialize(WriteBuffer & out) const;
String describe() const;
void deserialize(ReadBuffer & in);
};
2023-02-03 13:34:18 +00:00
struct InitialAllRangesAnnouncement
{
2023-02-03 13:34:18 +00:00
RangesInDataPartsDescription description;
size_t replica_num;
void serialize(WriteBuffer & out) const;
2023-02-03 13:34:18 +00:00
String describe();
void deserialize(ReadBuffer & in);
};
2023-02-03 13:34:18 +00:00
using MergeTreeAllRangesCallback = std::function<void(InitialAllRangesAnnouncement)>;
using MergeTreeReadTaskCallback = std::function<std::optional<ParallelReadResponse>(ParallelReadRequest)>;
}