file_writer.h 986 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #pragma once
  2. #include "retryful_writer.h"
  3. #include <yt/cpp/mapreduce/common/fwd.h>
  4. #include <yt/cpp/mapreduce/interface/io.h>
  5. namespace NYT {
  6. ////////////////////////////////////////////////////////////////////////////////
  7. class TFileWriter
  8. : public IFileWriter
  9. {
  10. public:
  11. TFileWriter(
  12. const TRichYPath& path,
  13. IClientRetryPolicyPtr clientRetryPolicy,
  14. ITransactionPingerPtr transactionPinger,
  15. const TClientContext& context,
  16. const TTransactionId& transactionId,
  17. const TFileWriterOptions& options = TFileWriterOptions());
  18. ~TFileWriter() override;
  19. protected:
  20. void DoWrite(const void* buf, size_t len) override;
  21. void DoFinish() override;
  22. size_t GetBufferMemoryUsage() const override;
  23. private:
  24. const bool AutoFinish_;
  25. TRetryfulWriter RetryfulWriter_;
  26. static const size_t BUFFER_SIZE = 64 << 20;
  27. };
  28. ////////////////////////////////////////////////////////////////////////////////
  29. } // namespace NYT