iceberg-cpp
Loading...
Searching...
No Matches
update_properties.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
22#include <memory>
23#include <optional>
24#include <string>
25#include <unordered_map>
26#include <unordered_set>
27
28#include "iceberg/iceberg_export.h"
29#include "iceberg/result.h"
30#include "iceberg/type_fwd.h"
32
35
36namespace iceberg {
37
39class ICEBERG_EXPORT UpdateProperties : public PendingUpdate {
40 public:
41 static Result<std::shared_ptr<UpdateProperties>> Make(
42 std::shared_ptr<TransactionContext> ctx);
43
44 ~UpdateProperties() override;
45
46 struct ApplyResult {
47 std::unordered_map<std::string, std::string> updates;
48 std::unordered_set<std::string> removals;
49 std::optional<int8_t> format_version;
50 };
51
60 UpdateProperties& Set(const std::string& key, const std::string& value);
61
66 UpdateProperties& Remove(const std::string& key);
67
68 Kind kind() const final { return Kind::kUpdateProperties; }
69 bool IsRetryable() const override { return true; }
70
72 Result<ApplyResult> Apply();
73
74 private:
75 explicit UpdateProperties(std::shared_ptr<TransactionContext> ctx);
76
77 std::unordered_map<std::string, std::string> updates_;
78 std::unordered_set<std::string> removals_;
79 std::optional<int8_t> format_version_;
80};
81
82} // namespace iceberg
Base class for all kinds of table metadata updates.
Definition pending_update.h:41
Updates table properties.
Definition update_properties.h:39
bool IsRetryable() const override
Whether this update can be retried after a commit conflict.
Definition update_properties.h:69
Kind kind() const final
Return the kind of this pending update.
Definition update_properties.h:68
Definition update_properties.h:46