iceberg-cpp
Loading...
Searching...
No Matches
pending_update.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20#pragma once
21
24
25#include <memory>
26
27#include "iceberg/iceberg_export.h"
28#include "iceberg/result.h"
29#include "iceberg/type_fwd.h"
31
32namespace iceberg {
33
41class ICEBERG_EXPORT PendingUpdate : public ErrorCollector {
42 public:
43 enum class Kind : uint8_t {
44 kExpireSnapshots,
45 kSetSnapshot,
46 kUpdateLocation,
47 kUpdatePartitionSpec,
48 kUpdatePartitionStatistics,
49 kUpdateProperties,
50 kUpdateSchema,
51 kUpdateSnapshot,
52 kUpdateSnapshotReference,
53 kUpdateSortOrder,
54 kUpdateStatistics,
55 };
56
58 virtual Kind kind() const = 0;
59
61 virtual bool IsRetryable() const = 0;
62
69 virtual Status Commit();
70
79 virtual Status Finalize(Result<const TableMetadata*> commit_result);
80
81 // Non-copyable, movable
82 PendingUpdate(const PendingUpdate&) = delete;
83 PendingUpdate& operator=(const PendingUpdate&) = delete;
84 PendingUpdate(PendingUpdate&&) noexcept = default;
85 PendingUpdate& operator=(PendingUpdate&&) noexcept = default;
86
87 ~PendingUpdate() override;
88
89 protected:
90 explicit PendingUpdate(std::shared_ptr<TransactionContext> ctx);
91
92 const TableMetadata& base() const;
93
94 std::shared_ptr<TransactionContext> ctx_;
95};
96
97} // namespace iceberg
Base class for collecting errors in the builder pattern.
Definition error_collector.h:93
Base class for all kinds of table metadata updates.
Definition pending_update.h:41
virtual Kind kind() const =0
Return the kind of this pending update.
virtual bool IsRetryable() const =0
Whether this update can be retried after a commit conflict.
Shared context between Transaction and PendingUpdate instances.
Definition transaction.h:161
STL namespace.
Represents the metadata for an Iceberg table.
Definition table_metadata.h:72