1#pragma once
2
3#include <atomic>
4#include <functional>
5
6
7namespace DB
8{
9
10class ReadBuffer;
11class WriteBuffer;
12
13
14/** Copies data from ReadBuffer to WriteBuffer, all that is.
15 */
16void copyData(ReadBuffer & from, WriteBuffer & to);
17
18/** Copies `bytes` bytes from ReadBuffer to WriteBuffer. If there are no `bytes` bytes, then throws an exception.
19 */
20void copyData(ReadBuffer & from, WriteBuffer & to, size_t bytes);
21
22/** The same, with the condition to cancel.
23 */
24void copyData(ReadBuffer & from, WriteBuffer & to, const std::atomic<int> & is_cancelled);
25void copyData(ReadBuffer & from, WriteBuffer & to, size_t bytes, const std::atomic<int> & is_cancelled);
26
27void copyData(ReadBuffer & from, WriteBuffer & to, std::function<void()> cancellation_hook);
28void copyData(ReadBuffer & from, WriteBuffer & to, size_t bytes, std::function<void()> cancellation_hook);
29
30}
31