ClickHouse/dbms/DataStreams/BlockIO.h
Ivan 97f2a2213e
Move all folders inside /dbms one level up (#9974)
* Move some code outside dbms/src folder
* Fix paths
2020-04-02 02:51:21 +03:00

58 lines
1.2 KiB
C++

#pragma once
#include <DataStreams/IBlockStream_fwd.h>
#include <functional>
#include <Processors/QueryPipeline.h>
namespace DB
{
class ProcessListEntry;
struct BlockIO
{
BlockIO() = default;
BlockIO(BlockIO &&) = default;
BlockIO & operator= (BlockIO && rhs);
~BlockIO();
BlockIO(const BlockIO &) = delete;
BlockIO & operator= (const BlockIO & rhs) = delete;
std::shared_ptr<ProcessListEntry> process_list_entry;
BlockOutputStreamPtr out;
BlockInputStreamPtr in;
QueryPipeline pipeline;
/// Callbacks for query logging could be set here.
std::function<void(IBlockInputStream *, IBlockOutputStream *)> finish_callback;
std::function<void()> exception_callback;
/// When it is true, don't bother sending any non-empty blocks to the out stream
bool null_format = false;
/// Call these functions if you want to log the request.
void onFinish()
{
if (finish_callback)
finish_callback(in.get(), out.get());
}
void onException()
{
if (exception_callback)
exception_callback();
}
private:
void reset();
};
}