iceberg-cpp
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
iceberg::RollingManifestWriter Class Reference

A rolling manifest writer that can produce multiple manifest files. More...

#include <rolling_manifest_writer.h>

Public Types

using ManifestWriterFactory = std::function< Result< std::unique_ptr< ManifestWriter > >()>
 Factory function type for creating ManifestWriter instances.
 

Public Member Functions

 RollingManifestWriter (ManifestWriterFactory manifest_writer_factory, int64_t target_file_size_in_bytes)
 Construct a rolling manifest writer.
 
Status WriteAddedEntry (std::shared_ptr< DataFile > file, std::optional< int64_t > data_sequence_number=std::nullopt)
 Add an added entry for a file.
 
Status WriteExistingEntry (std::shared_ptr< DataFile > file, int64_t file_snapshot_id, int64_t data_sequence_number, std::optional< int64_t > file_sequence_number=std::nullopt)
 Add an existing entry for a file.
 
Status WriteDeletedEntry (std::shared_ptr< DataFile > file, int64_t data_sequence_number, std::optional< int64_t > file_sequence_number=std::nullopt)
 Add a delete entry for a file.
 
Status Close ()
 Close the rolling manifest writer.
 
Result< std::vector< ManifestFile > > ToManifestFiles () const
 Get the list of manifest files produced by this writer.
 

Detailed Description

A rolling manifest writer that can produce multiple manifest files.

Constructor & Destructor Documentation

◆ RollingManifestWriter()

iceberg::RollingManifestWriter::RollingManifestWriter ( ManifestWriterFactory  manifest_writer_factory,
int64_t  target_file_size_in_bytes 
)

Construct a rolling manifest writer.

Parameters
manifest_writer_factoryFactory function to create new ManifestWriter instances.
target_file_size_in_bytesTarget file size in bytes. When the current file reaches this size (and row count is a multiple of 250), a new file will be created.

Member Function Documentation

◆ ToManifestFiles()

Result< std::vector< ManifestFile > > iceberg::RollingManifestWriter::ToManifestFiles ( ) const

Get the list of manifest files produced by this writer.

Returns
A vector of ManifestFile objects
Note
Only valid after the writer is closed.

◆ WriteAddedEntry()

Status iceberg::RollingManifestWriter::WriteAddedEntry ( std::shared_ptr< DataFile file,
std::optional< int64_t >  data_sequence_number = std::nullopt 
)

Add an added entry for a file.

Parameters
filea data file
Returns
Status indicating success or failure
Note
The entry's snapshot ID will be this manifest's snapshot ID. The entry's data sequence number will be the provided data sequence number. The entry's file sequence number will be assigned at commit.

◆ WriteDeletedEntry()

Status iceberg::RollingManifestWriter::WriteDeletedEntry ( std::shared_ptr< DataFile file,
int64_t  data_sequence_number,
std::optional< int64_t >  file_sequence_number = std::nullopt 
)

Add a delete entry for a file.

Parameters
filea deleted data file
data_sequence_numbera data sequence number of the file (assigned when the file was added)
file_sequence_numbera file sequence number (assigned when the file was added)
Returns
Status indicating success or failure
Note
The entry's snapshot ID will be this manifest's snapshot ID. However, the original data and file sequence numbers of the file must be preserved when the file is marked as deleted.

◆ WriteExistingEntry()

Status iceberg::RollingManifestWriter::WriteExistingEntry ( std::shared_ptr< DataFile file,
int64_t  file_snapshot_id,
int64_t  data_sequence_number,
std::optional< int64_t >  file_sequence_number = std::nullopt 
)

Add an existing entry for a file.

Parameters
filean existing data file
file_snapshot_idsnapshot ID when the data file was added to the table
data_sequence_numbera data sequence number of the file (assigned when the file was added)
file_sequence_numbera file sequence number (assigned when the file was added)
Returns
Status indicating success or failure
Note
The original data and file sequence numbers, snapshot ID, which were assigned at commit, must be preserved when adding an existing entry.

The documentation for this class was generated from the following files: