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

A snapshot of the data in a table at a point in time. More...

#include <snapshot.h>

Public Member Functions

std::optional< std::string_view > Operation () const
 Return the name of the DataOperations data operation that produced this snapshot.
 
Result< std::optional< int64_t > > FirstRowId () const
 The row-id of the first newly added row in this snapshot.
 
Result< std::optional< int64_t > > AddedRows () const
 The upper bound of number of rows with assigned row IDs in this snapshot.
 

Static Public Member Functions

static Result< std::unique_ptr< Snapshot > > Make (int64_t sequence_number, int64_t snapshot_id, std::optional< int64_t > parent_snapshot_id, TimePointMs timestamp_ms, std::string operation, std::unordered_map< std::string, std::string > summary, std::optional< int32_t > schema_id, std::string manifest_list, std::optional< int64_t > first_row_id=std::nullopt, std::optional< int64_t > added_rows=std::nullopt)
 Create a new Snapshot instance with validation on the inputs.
 

Public Attributes

int64_t snapshot_id
 A unique long ID.
 
std::optional< int64_t > parent_snapshot_id
 The snapshot ID of the snapshot's parent. Omitted for any snapshot with no parent.
 
int64_t sequence_number
 A monotonically increasing long that tracks the order of changes to a table.
 
TimePointMs timestamp_ms
 
std::string manifest_list
 
std::unordered_map< std::string, std::string > summary
 A string map that summaries the snapshot changes, including operation.
 
std::optional< int32_t > schema_id
 ID of the table's current schema when the snapshot was created.
 

Friends

bool operator== (const Snapshot &lhs, const Snapshot &rhs)
 Compare two snapshots for equality.
 

Detailed Description

A snapshot of the data in a table at a point in time.

A snapshot consist of one or more file manifests, and the complete table contents is the union of all the data files in those manifests.

Snapshots are created by table operations.

Member Function Documentation

◆ AddedRows()

Result< std::optional< int64_t > > iceberg::Snapshot::AddedRows ( ) const

The upper bound of number of rows with assigned row IDs in this snapshot.

It can be used safely to increment the table's next-row-id during a commit. It can be more than the number of rows added in this snapshot and include some existing rows.

This field is optional but is required when the table version supports row lineage.

Returns
the upper bound of number of rows with assigned row IDs in this snapshot or nullopt if the value was not stored.

◆ FirstRowId()

Result< std::optional< int64_t > > iceberg::Snapshot::FirstRowId ( ) const

The row-id of the first newly added row in this snapshot.

All rows added in this snapshot will have a row-id assigned to them greater than this value. All rows with a row-id less than this value were created in a snapshot that was added to the table (but not necessarily committed to this branch) in the past.

Returns
the first row-id to be used in this snapshot or nullopt when row lineage is not supported

◆ Operation()

std::optional< std::string_view > iceberg::Snapshot::Operation ( ) const

Return the name of the DataOperations data operation that produced this snapshot.

Returns
the operation that produced this snapshot, or nullopt if the operation is unknown.

Member Data Documentation

◆ manifest_list

std::string iceberg::Snapshot::manifest_list

The location of a manifest list for this snapshot that tracks manifest files with additional metadata.

◆ timestamp_ms

TimePointMs iceberg::Snapshot::timestamp_ms

A timestamp when the snapshot was created, used for garbage collection and table inspection.


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