mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-12 17:32:32 +00:00
605fc5f121
- Added finalizeImpl() override in ForkWriteBuffer to call finalize() of all the buffers. - Removed clearing buffer in ForkWriteBuffer destructor.
35 lines
684 B
C++
35 lines
684 B
C++
#pragma once
|
|
#include <IO/WriteBuffer.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
namespace ErrorCodes
|
|
{
|
|
}
|
|
|
|
/** ForkWriteBuffer takes a vector of WriteBuffer and writes data to all of them
|
|
* If the vector of WriteBufferPts is empty, then it throws an error
|
|
* It uses the buffer of the first element as its buffer and copies data from
|
|
* first buffer to all the other buffers
|
|
**/
|
|
class ForkWriteBuffer : public WriteBuffer
|
|
{
|
|
public:
|
|
|
|
using WriteBufferPtrs = std::vector<WriteBufferPtr>;
|
|
|
|
explicit ForkWriteBuffer(WriteBufferPtrs && sources_);
|
|
~ForkWriteBuffer() override;
|
|
|
|
protected:
|
|
void nextImpl() override;
|
|
void finalizeImpl() override;
|
|
|
|
private:
|
|
WriteBufferPtrs sources;
|
|
};
|
|
|
|
}
|