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

A transaction for performing multiple updates to a table. More...

#include <transaction.h>

Inheritance diagram for iceberg::Transaction:

Public Member Functions

const std::shared_ptr< Table > & table () const
 Return the Table that this transaction will update.
 
const TableMetadata * base () const
 Returns the base metadata without any changes.
 
const TableMetadata & current () const
 Return the current metadata with staged changes applied.
 
std::string MetadataFileLocation (std::string_view filename) const
 Return the location of the metadata file with the given filename.
 
Result< std::shared_ptr< Table > > Commit ()
 Apply the pending changes from all actions and commit.
 
Status Abort ()
 Discard staged changes and clean owned files best effort. Repeated Abort succeeds without repeating cleanup. Committed and unknown transactions cannot be aborted. Destructors never perform cleanup.
 
TransactionState state () const
 Return the current state of the transaction.
 
Result< std::shared_ptr< UpdatePartitionSpec > > NewUpdatePartitionSpec ()
 Create a new UpdatePartitionSpec to update the partition spec of this table and commit the changes.
 
Result< std::shared_ptr< UpdateProperties > > NewUpdateProperties ()
 Create a new UpdateProperties to update table properties and commit the changes.
 
Result< std::shared_ptr< UpdateSortOrder > > NewUpdateSortOrder ()
 Create a new UpdateSortOrder to update the table sort order and commit the changes.
 
Result< std::shared_ptr< UpdateSchema > > NewUpdateSchema ()
 Create a new UpdateSchema to alter the columns of this table and commit the changes.
 
Result< std::shared_ptr< ExpireSnapshots > > NewExpireSnapshots ()
 Create a new ExpireSnapshots to remove expired snapshots and commit the changes.
 
Result< std::shared_ptr< UpdateStatistics > > NewUpdateStatistics ()
 Create a new UpdateStatistics to update table statistics and commit the changes.
 
Result< std::shared_ptr< UpdatePartitionStatistics > > NewUpdatePartitionStatistics ()
 Create a new UpdatePartitionStatistics to update partition statistics and commit the changes.
 
Result< std::shared_ptr< UpdateLocation > > NewUpdateLocation ()
 Create a new UpdateLocation to update the table location and commit the changes.
 
Result< std::shared_ptr< FastAppend > > NewFastAppend ()
 Create a new FastAppend to append data files and commit the changes.
 
Result< std::shared_ptr< MergeAppend > > NewMergeAppend ()
 Create a new MergeAppend to append data files and merge manifests.
 
Result< std::shared_ptr< DeleteFiles > > NewDeleteFiles ()
 Create a new DeleteFiles to delete data files and commit the changes.
 
Result< std::shared_ptr< RowDelta > > NewRowDelta ()
 Create a new RowDelta to add rows and row-level deletes.
 
Result< std::shared_ptr< OverwriteFiles > > NewOverwrite ()
 Create a new OverwriteFiles to overwrite data files and commit the changes.
 
Result< std::shared_ptr< RewriteFiles > > NewRewriteFiles ()
 Create a new RewriteFiles to replace files in this table and commit the changes.
 
Result< std::shared_ptr< ReplacePartitions > > NewReplacePartitions ()
 Create a new ReplacePartitions to dynamically overwrite partitions and commit the changes.
 
Result< std::shared_ptr< RewriteManifests > > NewRewriteManifests ()
 Create a new RewriteManifests to rewrite manifest layout.
 
Result< std::shared_ptr< SnapshotManager > > NewSnapshotManager ()
 Create a new SnapshotManager to manage snapshots.
 
Result< std::shared_ptr< CherryPickOperation > > NewCherryPickOperation ()
 Create a new CherryPickOperation to apply the changes of an existing snapshot onto the current state.
 
Result< std::shared_ptr< SetSnapshot > > NewSetSnapshot ()
 Create a new SetSnapshot to set the current snapshot or rollback to a previous snapshot and commit the changes.
 
Result< std::shared_ptr< UpdateSnapshotReference > > NewUpdateSnapshotReference ()
 Create a new UpdateSnapshotReference to update snapshot references (branches and tags) and commit the changes.
 

Static Public Member Functions

static Result< std::shared_ptr< Transaction > > Make (std::shared_ptr< Table > table, TransactionKind kind)
 Create a new transaction.
 
static Result< std::shared_ptr< Transaction > > Make (std::shared_ptr< TransactionContext > ctx)
 Create a detached transaction from an existing context.
 

Friends

class PendingUpdate
 

Detailed Description

A transaction for performing multiple updates to a table.

Member Function Documentation

◆ Commit()

Result< std::shared_ptr< Table > > iceberg::Transaction::Commit ( )

Apply the pending changes from all actions and commit.

Returns
Updated table if the transaction was committed successfully, or an error:
  • ValidationFailed: if any update cannot be applied to the current table metadata.
  • CommitFailed: if the updates cannot be committed due to conflicts.

◆ Make()

static Result< std::shared_ptr< Transaction > > iceberg::Transaction::Make ( std::shared_ptr< TransactionContext >  ctx)
static

Create a detached transaction from an existing context.

This overload is used by PendingUpdate::Commit for standalone updates and does not attach the temporary transaction to the context.

◆ MetadataFileLocation()

std::string iceberg::Transaction::MetadataFileLocation ( std::string_view  filename) const

Return the location of the metadata file with the given filename.

Parameters
filenamethe name of the metadata file
Returns
the location of the metadata file

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