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
29#include "iceberg/result.h"
30#include "iceberg/type_fwd.h"
32
35
36namespace iceberg {
37
39class ICEBERG_EXPORT UpdateProperties : public PendingUpdate {
40 public:
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
61 UpdateProperties& Set(const std::string& key, const std::string& value);
62
67 UpdateProperties& Remove(const std::string& key);
68
69 Kind kind() const final { return Kind::kUpdateProperties; }
70 bool IsRetryable() const override { return true; }
71
74
75 private:
76 explicit UpdateProperties(std::shared_ptr<TransactionContext> ctx);
77
78 std::unordered_map<std::string, std::string> updates_;
79 std::unordered_set<std::string> removals_;
80 std::optional<int8_t> format_version_;
81};
82
83} // namespace iceberg
Base class for all kinds of table metadata updates.
Definition pending_update.h:41
Updates table properties.
Definition update_properties.h:39
UpdateProperties & Set(const std::string &key, const std::string &value)
Sets a property key to a specified value.
bool IsRetryable() const override
Whether this update can be retried after a commit conflict.
Definition update_properties.h:70
UpdateProperties & Remove(const std::string &key)
Marks a property for removal.
Result< ApplyResult > Apply()
Apply the pending changes and return the updates and removals.
Kind kind() const final
Return the kind of this pending update.
Definition update_properties.h:69
Define symbol visibility macros for core Iceberg APIs.
Core Apache Iceberg C++ APIs.
Definition arrow_io_util.h:33
std::expected< T, E > Result
Result alias.
Definition result.h:88
Define Result, Status, and error helpers.
Definition update_properties.h:46