iceberg-cpp
Loading...
Searching...
No Matches
Classes | Static Public Member Functions | List of all members
iceberg::TableMetadataUtil Struct Reference

Utility class for table metadata. More...

#include <table_metadata.h>

Classes

struct  Codec
 

Static Public Member Functions

static Result< std::unique_ptr< TableMetadata > > Read (class FileIO &io, const std::string &location, std::optional< size_t > length=std::nullopt)
 Read the table metadata file.
 
static Result< std::string > Write (FileIO &io, const TableMetadata *base, const std::string &base_metadata_location, TableMetadata &metadata)
 Write a new metadata file to storage.
 
static void DeleteRemovedMetadataFiles (FileIO &io, const TableMetadata *base, const TableMetadata &metadata)
 Delete removed metadata files based on retention policy.
 
static Status Write (FileIO &io, const std::string &location, const TableMetadata &metadata)
 Write the table metadata to a file.
 

Detailed Description

Utility class for table metadata.

Member Function Documentation

◆ DeleteRemovedMetadataFiles()

void iceberg::TableMetadataUtil::DeleteRemovedMetadataFiles ( FileIO io,
const TableMetadata base,
const TableMetadata metadata 
)
static

Delete removed metadata files based on retention policy.

Removes obsolete metadata files that are no longer referenced in the current metadata log, based on the metadata.delete-after-commit.enabled property.

Parameters
ioThe FileIO instance for deleting files
baseThe previous metadata version
metadataThe current metadata containing the updated log

◆ Read()

Result< std::unique_ptr< TableMetadata > > iceberg::TableMetadataUtil::Read ( class FileIO io,
const std::string &  location,
std::optional< size_t >  length = std::nullopt 
)
static

Read the table metadata file.

Parameters
ioThe file IO to use to read the table metadata.
locationThe location of the table metadata file.
lengthThe optional length of the table metadata file.
Returns
The table metadata.

◆ Write() [1/2]

Status iceberg::TableMetadataUtil::Write ( FileIO io,
const std::string &  location,
const TableMetadata metadata 
)
static

Write the table metadata to a file.

Parameters
ioThe file IO to use to write the table metadata.
locationThe location of the table metadata file.
metadataThe table metadata to write.

◆ Write() [2/2]

Result< std::string > iceberg::TableMetadataUtil::Write ( FileIO io,
const TableMetadata base,
const std::string &  base_metadata_location,
TableMetadata metadata 
)
static

Write a new metadata file to storage.

Serializes the table metadata to JSON and writes it to a new metadata file. If no location is specified in the metadata, generates a new file path based on the version number.

Parameters
ioThe FileIO instance for writing files
baseThe base metadata (can be null for new tables)
metadataThe metadata to write, which will be updated with the new location
Returns
The new metadata location

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