Skip to content

Commit 4852fcb

Browse files
committed
refactor: rename PendingUpdateBase to PendingUpdate for cleaner API
Renamed: - PendingUpdateBase -> PendingUpdate (non-template base class) - PendingUpdate<T> -> PendingUpdateTyped<T> (template class) This makes the API more intuitive: std::vector<std::unique_ptr<PendingUpdate>> is cleaner than std::vector<std::unique_ptr<PendingUpdateBase>>
1 parent 50d119f commit 4852fcb

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

src/iceberg/pending_update.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@
2828

2929
namespace iceberg {
3030

31-
/// \brief Non-template base class for table metadata changes using builder pattern
31+
/// \brief Base class for table metadata changes using builder pattern
3232
///
3333
/// This base class allows storing different types of PendingUpdate operations
3434
/// in the same collection (e.g., in Transaction). It provides the common Commit()
3535
/// interface that all updates share.
3636
///
3737
/// This matches the Java Iceberg pattern where BaseTransaction stores a
3838
/// List<PendingUpdate> without type parameters.
39-
class ICEBERG_EXPORT PendingUpdateBase {
39+
class ICEBERG_EXPORT PendingUpdate {
4040
public:
41-
virtual ~PendingUpdateBase() = default;
41+
virtual ~PendingUpdate() = default;
4242

4343
/// \brief Apply and commit the pending changes to the table
4444
///
@@ -53,18 +53,18 @@ class ICEBERG_EXPORT PendingUpdateBase {
5353
virtual Status Commit() = 0;
5454

5555
// Non-copyable, movable
56-
PendingUpdateBase(const PendingUpdateBase&) = delete;
57-
PendingUpdateBase& operator=(const PendingUpdateBase&) = delete;
58-
PendingUpdateBase(PendingUpdateBase&&) noexcept = default;
59-
PendingUpdateBase& operator=(PendingUpdateBase&&) noexcept = default;
56+
PendingUpdate(const PendingUpdate&) = delete;
57+
PendingUpdate& operator=(const PendingUpdate&) = delete;
58+
PendingUpdate(PendingUpdate&&) noexcept = default;
59+
PendingUpdate& operator=(PendingUpdate&&) noexcept = default;
6060

6161
protected:
62-
PendingUpdateBase() = default;
62+
PendingUpdate() = default;
6363
};
6464

6565
/// \brief Template class for type-safe table metadata changes using builder pattern
6666
///
67-
/// PendingUpdate extends PendingUpdateBase with a type-safe Apply() method that
67+
/// PendingUpdateTyped extends PendingUpdate with a type-safe Apply() method that
6868
/// returns the specific result type for each operation. Subclasses implement
6969
/// specific types of table updates such as schema changes, property updates, or
7070
/// snapshot-producing operations like appends and deletes.
@@ -74,9 +74,9 @@ class ICEBERG_EXPORT PendingUpdateBase {
7474
///
7575
/// \tparam T The type of result returned by Apply()
7676
template <typename T>
77-
class ICEBERG_EXPORT PendingUpdate : public PendingUpdateBase {
77+
class ICEBERG_EXPORT PendingUpdateTyped : public PendingUpdate {
7878
public:
79-
~PendingUpdate() override = default;
79+
~PendingUpdateTyped() override = default;
8080

8181
/// \brief Apply the pending changes and return the uncommitted result
8282
///
@@ -88,7 +88,7 @@ class ICEBERG_EXPORT PendingUpdate : public PendingUpdateBase {
8888
virtual Result<T> Apply() = 0;
8989

9090
protected:
91-
PendingUpdate() = default;
91+
PendingUpdateTyped() = default;
9292
};
9393

9494
} // namespace iceberg

src/iceberg/test/pending_update_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace iceberg {
2929
// Mock implementation for testing the interface
3030
class MockSnapshot {};
3131

32-
class MockPendingUpdate : public PendingUpdate<MockSnapshot> {
32+
class MockPendingUpdate : public PendingUpdateTyped<MockSnapshot> {
3333
public:
3434
MockPendingUpdate() = default;
3535

@@ -91,7 +91,7 @@ TEST(PendingUpdateTest, CommitFailed) {
9191
}
9292

9393
TEST(PendingUpdateTest, BaseClassPolymorphism) {
94-
std::unique_ptr<PendingUpdateBase> base_ptr = std::make_unique<MockPendingUpdate>();
94+
std::unique_ptr<PendingUpdate> base_ptr = std::make_unique<MockPendingUpdate>();
9595
auto status = base_ptr->Commit();
9696
EXPECT_THAT(status, IsOk());
9797
}

src/iceberg/type_fwd.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,9 @@ class TableRequirement;
154154
class TableMetadataBuilder;
155155
class TableUpdateContext;
156156

157-
class PendingUpdateBase;
158-
template <typename T>
159157
class PendingUpdate;
158+
template <typename T>
159+
class PendingUpdateTyped;
160160

161161
/// ----------------------------------------------------------------------------
162162
/// TODO: Forward declarations below are not added yet.

0 commit comments

Comments
 (0)