30#include <unordered_map>
51 std::unique_ptr<OutputFile> output_file,
52 std::unordered_map<std::string, std::string> properties = {},
54 bool compress_footer =
false);
77 PuffinWriter(std::unique_ptr<PositionOutputStream> stream,
78 std::unordered_map<std::string, std::string> properties,
81 Status WriteBytes(std::span<const std::byte> data);
86 std::unique_ptr<PositionOutputStream> stream_;
88 std::unordered_map<std::string, std::string> properties_;
92 const bool compress_footer_;
94 std::vector<BlobMetadata> written_blobs_metadata_;
96 bool header_written_ =
false;
98 bool footer_written_ =
false;
100 bool finished_ =
false;
102 int64_t footer_size_ = -1;
104 int64_t file_size_ = -1;
Writer for Puffin files.
Definition puffin_writer.h:43
Result< int64_t > FooterSize() const
Get the footer size. Returns error if the footer has not been written.
static Result< std::unique_ptr< PuffinWriter > > Make(std::unique_ptr< OutputFile > output_file, std::unordered_map< std::string, std::string > properties={}, PuffinCompressionCodec default_codec=PuffinCompressionCodec::kNone, bool compress_footer=false)
Create a PuffinWriter for the given output file.
Status Finish()
Finalize the file by writing the footer and closing the stream.
Result< BlobMetadata > Write(const Blob &blob)
Write a blob and return its metadata.
Result< int64_t > FileSize() const
Get the total file size. Returns error if Finish() has not succeeded.
Status Close()
Close the writer, finalizing the file if needed.
const std::vector< BlobMetadata > & written_blobs_metadata() const
Get metadata for all blobs written so far.
Define symbol visibility macros for core Iceberg APIs.
Puffin file metadata, reader, and writer APIs.
Definition file_metadata.h:35
PuffinCompressionCodec
Compression codecs supported by Puffin files.
Definition file_metadata.h:38
std::expected< T, E > Result
Result alias.
Definition result.h:88
Define Result, Status, and error helpers.
A blob in a Puffin file.
Definition file_metadata.h:70