#pragma once #include #include #include #include #include namespace NYT { //////////////////////////////////////////////////////////////////////////////// namespace NDetail { //////////////////////////////////////////////////////////////////////////////// class TJobWriterStream { public: explicit TJobWriterStream(int fd); explicit TJobWriterStream(const TFile& file); ~TJobWriterStream() = default; public: static constexpr size_t BufferSize = 1 << 20; TFile FDFile; TUnbufferedFileOutput FDOutput; TBufferedOutput BufferedOutput; }; //////////////////////////////////////////////////////////////////////////////// } // namespace NDetail //////////////////////////////////////////////////////////////////////////////// class TJobWriter : public IProxyOutput { public: explicit TJobWriter(size_t outputTableCount); explicit TJobWriter(const TVector& fileList); size_t GetBufferMemoryUsage() const override; size_t GetStreamCount() const override; IOutputStream* GetStream(size_t tableIndex) const override; void OnRowFinished(size_t tableIndex) override; private: TVector> Streams_; }; //////////////////////////////////////////////////////////////////////////////// class TSingleStreamJobWriter : public IProxyOutput { public: explicit TSingleStreamJobWriter(size_t tableIndex); size_t GetBufferMemoryUsage() const override; size_t GetStreamCount() const override; IOutputStream* GetStream(size_t tableIndex) const override; void OnRowFinished(size_t tableIndex) override; private: const size_t TableIndex_; std::unique_ptr Stream_; }; //////////////////////////////////////////////////////////////////////////////// } // namespace NYT