iceberg-cpp
Loading...
Searching...
No Matches
catalog_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 <cstdint>
23#include <string>
24#include <unordered_map>
25
27#include "iceberg/result.h"
28#include "iceberg/util/config.h"
29
32
33namespace iceberg::rest {
34
36enum class SnapshotMode : uint8_t { kAll, kRefs };
37
39enum class ScanPlanningMode : uint8_t { kClient, kServer };
40
42class ICEBERG_REST_EXPORT RestCatalogProperties
43 : public ConfigBase<RestCatalogProperties> {
44 public:
45 template <typename T>
46 using Entry = const ConfigBase<RestCatalogProperties>::Entry<T>;
47
49 inline static Entry<std::string> kUri{"uri", ""};
51 inline static Entry<std::string> kName{"name", ""};
53 inline static Entry<std::string> kWarehouse{"warehouse", ""};
55 inline static Entry<std::string> kIOImpl{"io-impl", ""};
57 inline static Entry<std::string> kPrefix{"prefix", ""};
59 inline static Entry<std::string> kNamespaceSeparator{"namespace-separator", "%1F"};
61 inline static Entry<std::string> kSnapshotLoadingMode{"snapshot-loading-mode", "ALL"};
63 inline static Entry<std::string> kMetricsReportingEnabled{
64 "rest-metrics-reporting-enabled", "true"};
66 inline static Entry<std::string> kScanPlanningMode{"scan-planning-mode", "client"};
68 inline static Entry<int64_t> kScanPlanningPollTimeoutMs{
69 "rest-scan-planning.poll-timeout-ms", 300000};
71 inline static Entry<int32_t> kScanPlanningPollNumRetries{
72 "rest-scan-planning.poll-num-retries", 10};
74 inline static constexpr std::string_view kHeaderPrefix = "header.";
76 inline static Entry<int64_t> kClientConnectionTimeoutMs{
77 "rest.client.connection-timeout-ms", 0};
79 inline static Entry<int64_t> kClientSocketTimeoutMs{"rest.client.socket-timeout-ms", 0};
80
84 inline static Entry<bool> kTrustServerOAuth2Uri{"rest.auth.oauth2.trust-server-uri",
85 true};
86
89
92 std::unordered_map<std::string, std::string> properties);
93
95 std::unordered_map<std::string, std::string> ExtractHeaders() const;
96
100
106
110 const std::unordered_map<std::string, std::string>& config);
111};
112
113} // namespace iceberg::rest
Definition config.h:73
Definition config.h:70
Definition expected.h:1199
Configuration class for a REST Catalog.
Definition catalog_properties.h:43
static RestCatalogProperties default_properties()
Create a default RestCatalogProperties instance.
Result< SnapshotMode > SnapshotLoadingMode() const
Get the snapshot loading mode.
static RestCatalogProperties FromMap(std::unordered_map< std::string, std::string > properties)
Create a RestCatalogProperties instance from a map of key-value pairs.
static Result< std::optional< ScanPlanningMode > > ScanPlanningModeFrom(const std::unordered_map< std::string, std::string > &config)
Get the scan planning mode from the given config map, returning std::nullopt if the key is absent.
std::unordered_map< std::string, std::string > ExtractHeaders() const
Returns HTTP headers to be added to every request.
Result< std::string_view > Uri() const
Get the URI of the REST catalog server.
Provide typed configuration helpers.
Define symbol visibility macros for the REST catalog library.
REST catalog APIs.
Definition auth_manager.h:34
SnapshotMode
Snapshot loading mode for REST catalog.
Definition catalog_properties.h:36
ScanPlanningMode
Scan planning mode for REST catalog.
Definition catalog_properties.h:39
Define Result, Status, and error helpers.