ClickHouse/src/IO/ForkWriteBuffer.h
Smita Kulkarni 605fc5f121 Addressed review comments
- Added finalizeImpl() override in ForkWriteBuffer to call finalize() of all the buffers.
- Removed clearing buffer in ForkWriteBuffer destructor.
2022-07-20 21:02:54 +02:00

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;
};
}