2014-04-08 06:51:53 +00:00
|
|
|
#pragma once
|
2011-05-16 16:31:19 +00:00
|
|
|
|
2015-12-24 21:28:18 +00:00
|
|
|
#include <atomic>
|
2016-03-01 17:47:53 +00:00
|
|
|
#include <functional>
|
2015-12-24 21:28:18 +00:00
|
|
|
|
2011-05-16 16:31:19 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2016-02-16 16:39:39 +00:00
|
|
|
class ReadBuffer;
|
|
|
|
class WriteBuffer;
|
|
|
|
|
|
|
|
|
2017-05-28 14:29:40 +00:00
|
|
|
/** Copies data from ReadBuffer to WriteBuffer, all that is.
|
2011-05-16 16:31:19 +00:00
|
|
|
*/
|
|
|
|
void copyData(ReadBuffer & from, WriteBuffer & to);
|
|
|
|
|
2017-05-28 14:29:40 +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);
|
|
|
|
|
2017-05-28 14:29:40 +00:00
|
|
|
/** The same, with the condition to cancel.
|
2015-12-24 21:28:18 +00:00
|
|
|
*/
|
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);
|
2015-12-24 21:28:18 +00:00
|
|
|
|
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);
|
2015-12-24 21:28:18 +00:00
|
|
|
|
2011-05-16 16:31:19 +00:00
|
|
|
}
|