40class ICEBERG_EXPORT
Transaction :
public std::enable_shared_from_this<Transaction> {
45 static Result<std::shared_ptr<Transaction>> Make(std::shared_ptr<Table> table,
46 TransactionKind kind);
49 static Result<std::shared_ptr<Transaction>> Make(
50 std::shared_ptr<TransactionContext> ctx);
53 const std::shared_ptr<Table>& table()
const;
65 std::string MetadataFileLocation(std::string_view filename)
const;
72 Result<std::shared_ptr<Table>> Commit();
76 Result<std::shared_ptr<UpdatePartitionSpec>> NewUpdatePartitionSpec();
80 Result<std::shared_ptr<UpdateProperties>> NewUpdateProperties();
84 Result<std::shared_ptr<UpdateSortOrder>> NewUpdateSortOrder();
88 Result<std::shared_ptr<UpdateSchema>> NewUpdateSchema();
92 Result<std::shared_ptr<ExpireSnapshots>> NewExpireSnapshots();
96 Result<std::shared_ptr<UpdateStatistics>> NewUpdateStatistics();
100 Result<std::shared_ptr<UpdatePartitionStatistics>> NewUpdatePartitionStatistics();
104 Result<std::shared_ptr<UpdateLocation>> NewUpdateLocation();
107 Result<std::shared_ptr<FastAppend>> NewFastAppend();
110 Result<std::shared_ptr<SnapshotManager>> NewSnapshotManager();
114 Result<std::shared_ptr<SetSnapshot>> NewSetSnapshot();
118 Result<std::shared_ptr<UpdateSnapshotReference>> NewUpdateSnapshotReference();
121 explicit Transaction(std::shared_ptr<TransactionContext> ctx);
123 Status AddUpdate(
const std::shared_ptr<PendingUpdate>& update);
142 Result<std::shared_ptr<Table>> CommitOnce(
bool is_first_attempt);
145 bool CanRetry()
const;
151 std::shared_ptr<TransactionContext> ctx_;
153 std::vector<std::shared_ptr<PendingUpdate>> pending_updates_;
155 bool last_update_committed_ =
true;
157 bool committed_ =
false;
166 static Result<std::shared_ptr<TransactionContext>> Make(std::shared_ptr<Table> table,
167 TransactionKind kind);
171 std::string MetadataFileLocation(std::string_view filename)
const;
173 std::shared_ptr<Table> table;
174 std::unique_ptr<TableMetadataBuilder> metadata_builder;
175 TransactionKind kind;
178 std::optional<std::weak_ptr<Transaction>> transaction;
Shared context between Transaction and PendingUpdate instances.
Definition transaction.h:161