Skip to content

Commit 1916f3a

Browse files
committed
refactor: change NewExpireSnapshots to return unique_ptr
Change Table::NewExpireSnapshots() and Transaction::NewExpireSnapshots() to return std::unique_ptr instead of std::shared_ptr for consistency with other factory methods (NewScan, NewTransaction) that create new objects with exclusive ownership transfer to the caller.
1 parent 66809ae commit 1916f3a

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/iceberg/table.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ std::unique_ptr<Transaction> Table::NewTransaction() const {
115115
throw NotImplemented("Table::NewTransaction is not implemented");
116116
}
117117

118-
std::shared_ptr<iceberg::ExpireSnapshots> Table::NewExpireSnapshots() {
119-
return std::make_shared<iceberg::ExpireSnapshots>(this);
118+
std::unique_ptr<iceberg::ExpireSnapshots> Table::NewExpireSnapshots() {
119+
return std::make_unique<iceberg::ExpireSnapshots>(this);
120120
}
121121

122122
const std::shared_ptr<FileIO>& Table::io() const { return io_; }

src/iceberg/table.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ class ICEBERG_EXPORT Table {
117117

118118
/// \brief Create a new expire snapshots operation for this table
119119
///
120-
/// \return a shared pointer to the new ExpireSnapshots operation
121-
virtual std::shared_ptr<ExpireSnapshots> NewExpireSnapshots();
120+
/// \return a unique pointer to the new ExpireSnapshots operation
121+
virtual std::unique_ptr<ExpireSnapshots> NewExpireSnapshots();
122122

123123
/// \brief Returns a FileIO to read and write table data and metadata files
124124
const std::shared_ptr<FileIO>& io() const;

src/iceberg/transaction.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ class ICEBERG_EXPORT Transaction {
4646

4747
/// \brief Create a new expire snapshots operation for this transaction
4848
///
49-
/// \return a shared pointer to the new ExpireSnapshots operation
50-
virtual std::shared_ptr<ExpireSnapshots> NewExpireSnapshots() = 0;
49+
/// \return a unique pointer to the new ExpireSnapshots operation
50+
virtual std::unique_ptr<ExpireSnapshots> NewExpireSnapshots() = 0;
5151

5252
/// \brief Apply the pending changes from all actions and commit
5353
///

0 commit comments

Comments
 (0)