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