|
32 | 32 | #include "iceberg/table_scan.h" |
33 | 33 | #include "iceberg/transaction.h" |
34 | 34 | #include "iceberg/update/expire_snapshots.h" |
| 35 | +#include "iceberg/update/fast_append.h" |
| 36 | +#include "iceberg/update/set_snapshot.h" |
35 | 37 | #include "iceberg/update/snapshot_manager.h" |
| 38 | +#include "iceberg/update/update_location.h" |
36 | 39 | #include "iceberg/update/update_partition_spec.h" |
37 | 40 | #include "iceberg/update/update_partition_statistics.h" |
38 | 41 | #include "iceberg/update/update_properties.h" |
39 | 42 | #include "iceberg/update/update_schema.h" |
| 43 | +#include "iceberg/update/update_snapshot_reference.h" |
| 44 | +#include "iceberg/update/update_sort_order.h" |
40 | 45 | #include "iceberg/update/update_statistics.h" |
41 | 46 | #include "iceberg/util/macros.h" |
42 | 47 |
|
@@ -166,71 +171,61 @@ Table::NewIncrementalChangelogScan() const { |
166 | 171 | Result<std::shared_ptr<Transaction>> Table::NewTransaction() { |
167 | 172 | // Create a brand new transaction object for the table. Users are expected to commit the |
168 | 173 | // transaction manually. |
169 | | - return Transaction::Make(shared_from_this(), Transaction::Kind::kUpdate, |
170 | | - /*auto_commit=*/false); |
| 174 | + return Transaction::Make(shared_from_this(), TransactionKind::kUpdate); |
171 | 175 | } |
172 | 176 |
|
173 | 177 | Result<std::shared_ptr<UpdatePartitionSpec>> Table::NewUpdatePartitionSpec() { |
174 | 178 | ICEBERG_ASSIGN_OR_RAISE( |
175 | | - auto transaction, Transaction::Make(shared_from_this(), Transaction::Kind::kUpdate, |
176 | | - /*auto_commit=*/true)); |
177 | | - return transaction->NewUpdatePartitionSpec(); |
| 179 | + auto ctx, TransactionContext::Make(shared_from_this(), TransactionKind::kUpdate)); |
| 180 | + return UpdatePartitionSpec::Make(std::move(ctx)); |
178 | 181 | } |
179 | 182 |
|
180 | 183 | Result<std::shared_ptr<UpdateProperties>> Table::NewUpdateProperties() { |
181 | 184 | ICEBERG_ASSIGN_OR_RAISE( |
182 | | - auto transaction, Transaction::Make(shared_from_this(), Transaction::Kind::kUpdate, |
183 | | - /*auto_commit=*/true)); |
184 | | - return transaction->NewUpdateProperties(); |
| 185 | + auto ctx, TransactionContext::Make(shared_from_this(), TransactionKind::kUpdate)); |
| 186 | + return UpdateProperties::Make(std::move(ctx)); |
185 | 187 | } |
186 | 188 |
|
187 | 189 | Result<std::shared_ptr<UpdateSortOrder>> Table::NewUpdateSortOrder() { |
188 | 190 | ICEBERG_ASSIGN_OR_RAISE( |
189 | | - auto transaction, Transaction::Make(shared_from_this(), Transaction::Kind::kUpdate, |
190 | | - /*auto_commit=*/true)); |
191 | | - return transaction->NewUpdateSortOrder(); |
| 191 | + auto ctx, TransactionContext::Make(shared_from_this(), TransactionKind::kUpdate)); |
| 192 | + return UpdateSortOrder::Make(std::move(ctx)); |
192 | 193 | } |
193 | 194 |
|
194 | 195 | Result<std::shared_ptr<UpdateSchema>> Table::NewUpdateSchema() { |
195 | 196 | ICEBERG_ASSIGN_OR_RAISE( |
196 | | - auto transaction, Transaction::Make(shared_from_this(), Transaction::Kind::kUpdate, |
197 | | - /*auto_commit=*/true)); |
198 | | - return transaction->NewUpdateSchema(); |
| 197 | + auto ctx, TransactionContext::Make(shared_from_this(), TransactionKind::kUpdate)); |
| 198 | + return UpdateSchema::Make(std::move(ctx)); |
199 | 199 | } |
200 | 200 |
|
201 | 201 | Result<std::shared_ptr<ExpireSnapshots>> Table::NewExpireSnapshots() { |
202 | 202 | ICEBERG_ASSIGN_OR_RAISE( |
203 | | - auto transaction, Transaction::Make(shared_from_this(), Transaction::Kind::kUpdate, |
204 | | - /*auto_commit=*/true)); |
205 | | - return transaction->NewExpireSnapshots(); |
| 203 | + auto ctx, TransactionContext::Make(shared_from_this(), TransactionKind::kUpdate)); |
| 204 | + return ExpireSnapshots::Make(std::move(ctx)); |
206 | 205 | } |
207 | 206 |
|
208 | 207 | Result<std::shared_ptr<UpdateLocation>> Table::NewUpdateLocation() { |
209 | 208 | ICEBERG_ASSIGN_OR_RAISE( |
210 | | - auto transaction, Transaction::Make(shared_from_this(), Transaction::Kind::kUpdate, |
211 | | - /*auto_commit=*/true)); |
212 | | - return transaction->NewUpdateLocation(); |
| 209 | + auto ctx, TransactionContext::Make(shared_from_this(), TransactionKind::kUpdate)); |
| 210 | + return UpdateLocation::Make(std::move(ctx)); |
213 | 211 | } |
214 | 212 |
|
215 | 213 | Result<std::shared_ptr<FastAppend>> Table::NewFastAppend() { |
216 | 214 | ICEBERG_ASSIGN_OR_RAISE( |
217 | | - auto transaction, Transaction::Make(shared_from_this(), Transaction::Kind::kUpdate, |
218 | | - /*auto_commit=*/true)); |
219 | | - return transaction->NewFastAppend(); |
| 215 | + auto ctx, TransactionContext::Make(shared_from_this(), TransactionKind::kUpdate)); |
| 216 | + return FastAppend::Make(name().name, std::move(ctx)); |
220 | 217 | } |
221 | 218 |
|
222 | 219 | Result<std::shared_ptr<UpdateStatistics>> Table::NewUpdateStatistics() { |
223 | 220 | ICEBERG_ASSIGN_OR_RAISE( |
224 | | - auto transaction, Transaction::Make(shared_from_this(), Transaction::Kind::kUpdate, |
225 | | - /*auto_commit=*/true)); |
226 | | - return transaction->NewUpdateStatistics(); |
| 221 | + auto ctx, TransactionContext::Make(shared_from_this(), TransactionKind::kUpdate)); |
| 222 | + return UpdateStatistics::Make(std::move(ctx)); |
227 | 223 | } |
228 | 224 |
|
229 | 225 | Result<std::shared_ptr<UpdatePartitionStatistics>> Table::NewUpdatePartitionStatistics() { |
230 | 226 | ICEBERG_ASSIGN_OR_RAISE( |
231 | | - auto transaction, Transaction::Make(shared_from_this(), Transaction::Kind::kUpdate, |
232 | | - /*auto_commit=*/true)); |
233 | | - return transaction->NewUpdatePartitionStatistics(); |
| 227 | + auto ctx, TransactionContext::Make(shared_from_this(), TransactionKind::kUpdate)); |
| 228 | + return UpdatePartitionStatistics::Make(std::move(ctx)); |
234 | 229 | } |
235 | 230 |
|
236 | 231 | Result<std::shared_ptr<SnapshotManager>> Table::NewSnapshotManager() { |
|
0 commit comments