ClickHouse/src/IO/copyData.h

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

35 lines
1.2 KiB
C++
Raw Normal View History

2014-04-08 06:51:53 +00:00
#pragma once
#include <atomic>
2016-03-01 17:47:53 +00:00
#include <functional>
namespace DB
{
class ReadBuffer;
class WriteBuffer;
2021-05-26 20:37:44 +00:00
class Throttler;
using ThrottlerPtr = std::shared_ptr<Throttler>;
2021-05-27 12:54:47 +00:00
/// Copies data from ReadBuffer to WriteBuffer, all that is.
void copyData(ReadBuffer & from, WriteBuffer & to);
2021-05-27 12:54:47 +00:00
/// Copies `bytes` bytes from ReadBuffer to WriteBuffer. If there are no `bytes` bytes, then throws an exception.
2014-04-02 13:45:39 +00:00
void copyData(ReadBuffer & from, WriteBuffer & to, size_t bytes);
2021-05-27 12:54:47 +00:00
/// The same, with the condition to cancel.
2018-05-25 11:45:19 +00:00
void copyData(ReadBuffer & from, WriteBuffer & to, const std::atomic<int> & is_cancelled);
void copyData(ReadBuffer & from, WriteBuffer & to, size_t bytes, const std::atomic<int> & is_cancelled);
2016-03-01 17:47:53 +00:00
void copyData(ReadBuffer & from, WriteBuffer & to, std::function<void()> cancellation_hook);
void copyData(ReadBuffer & from, WriteBuffer & to, size_t bytes, std::function<void()> cancellation_hook);
2021-05-27 12:54:47 +00:00
/// Same as above but also use throttler to limit maximum speed
void copyDataWithThrottler(ReadBuffer & from, WriteBuffer & to, const std::atomic<int> & is_cancelled, ThrottlerPtr throttler);
void copyDataWithThrottler(ReadBuffer & from, WriteBuffer & to, size_t bytes, const std::atomic<int> & is_cancelled, ThrottlerPtr throttler);
}