Skip to content

Commit fff474f

Browse files
committed
Update Metadata creation to return unique_ptr
1 parent d841ad4 commit fff474f

6 files changed

Lines changed: 10 additions & 10 deletions

File tree

src/iceberg/inspect/history_table.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ TableIdentifier HistoryTable::CreateName(const TableIdentifier& source_name) {
4848
return TableIdentifier{source_name.ns, source_name.name + ".history"};
4949
}
5050

51-
Result<std::shared_ptr<HistoryTable>> HistoryTable::Make(std::shared_ptr<Table> table) {
52-
return std::shared_ptr<HistoryTable>(new HistoryTable(table));
51+
Result<std::unique_ptr<HistoryTable>> HistoryTable::Make(std::shared_ptr<Table> table) {
52+
return std::unique_ptr<HistoryTable>(new HistoryTable(table));
5353
}
5454

5555
} // namespace iceberg

src/iceberg/inspect/history_table.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class ICEBERG_EXPORT HistoryTable : public MetadataTable {
4242
///
4343
/// \param[in] table The source table
4444
/// \return A HistoryTable instance or error status
45-
static Result<std::shared_ptr<HistoryTable>> Make(std::shared_ptr<Table> table);
45+
static Result<std::unique_ptr<HistoryTable>> Make(std::shared_ptr<Table> table);
4646

4747
~HistoryTable() override;
4848

src/iceberg/inspect/metadata_table.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ Result<std::unique_ptr<TableScanBuilder>> MetadataTable::NewScan() const {
5454
return NotSupported("TODO: Scanning metadata tables is not yet supported");
5555
};
5656

57-
Result<std::shared_ptr<SnapshotsTable>> MetadataTableFactory::GetSnapshotsTable(
57+
Result<std::unique_ptr<SnapshotsTable>> MetadataTableFactory::GetSnapshotsTable(
5858
std::shared_ptr<Table> table) {
5959
return SnapshotsTable::Make(table);
6060
}
6161

62-
Result<std::shared_ptr<HistoryTable>> MetadataTableFactory::GetHistoryTable(
62+
Result<std::unique_ptr<HistoryTable>> MetadataTableFactory::GetHistoryTable(
6363
std::shared_ptr<Table> table) {
6464
return HistoryTable::Make(table);
6565
}

src/iceberg/inspect/metadata_table.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,14 @@ class ICEBERG_EXPORT MetadataTableFactory {
177177
///
178178
/// \param table The source table
179179
/// \return A SnapshotsTable exposing all snapshots or error status
180-
static Result<std::shared_ptr<SnapshotsTable>> GetSnapshotsTable(
180+
static Result<std::unique_ptr<SnapshotsTable>> GetSnapshotsTable(
181181
std::shared_ptr<Table> table);
182182

183183
/// \brief Create a HistoryTable from a table
184184
///
185185
/// \param table The source table
186186
/// \return A HistoryTable exposing snapshot history or error status
187-
static Result<std::shared_ptr<HistoryTable>> GetHistoryTable(
187+
static Result<std::unique_ptr<HistoryTable>> GetHistoryTable(
188188
std::shared_ptr<Table> table);
189189
};
190190

src/iceberg/inspect/snapshots_table.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ TableIdentifier SnapshotsTable::CreateName(const TableIdentifier& source_name) {
5454
return TableIdentifier{source_name.ns, source_name.name + ".snapshots"};
5555
}
5656

57-
Result<std::shared_ptr<SnapshotsTable>> SnapshotsTable::Make(
57+
Result<std::unique_ptr<SnapshotsTable>> SnapshotsTable::Make(
5858
std::shared_ptr<Table> table) {
59-
return std::shared_ptr<SnapshotsTable>(new SnapshotsTable(table));
59+
return std::unique_ptr<SnapshotsTable>(new SnapshotsTable(table));
6060
}
6161

6262
} // namespace iceberg

src/iceberg/inspect/snapshots_table.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class ICEBERG_EXPORT SnapshotsTable : public MetadataTable {
4242
///
4343
/// \param[in] table The source table
4444
/// \return A SnapshotsTable instance or error status
45-
static Result<std::shared_ptr<SnapshotsTable>> Make(std::shared_ptr<Table> table);
45+
static Result<std::unique_ptr<SnapshotsTable>> Make(std::shared_ptr<Table> table);
4646

4747
~SnapshotsTable() override;
4848

0 commit comments

Comments
 (0)