iceberg-cpp
Loading...
Searching...
No Matches
table_identifier.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 <string>
26#include <vector>
27
28#include "iceberg/iceberg_export.h"
29#include "iceberg/result.h"
30#include "iceberg/util/formatter.h" // IWYU pragma: keep
31
32namespace iceberg {
33
35struct ICEBERG_EXPORT Namespace {
36 std::vector<std::string> levels;
37
38 bool operator==(const Namespace& other) const { return levels == other.levels; }
39
40 std::string ToString() const;
41};
42
43ICEBERG_EXPORT inline std::string ToString(const Namespace& ns) { return ns.ToString(); }
44
46struct ICEBERG_EXPORT TableIdentifier {
47 Namespace ns;
48 std::string name;
49
50 bool operator==(const TableIdentifier& other) const {
51 return ns == other.ns && name == other.name;
52 }
53
55 Status Validate() const {
56 if (name.empty()) {
57 return Invalid("Invalid table identifier: missing table name");
58 }
59 return {};
60 }
61
62 std::string ToString() const;
63};
64
65ICEBERG_EXPORT inline std::string ToString(const TableIdentifier& ident) {
66 return ident.ToString();
67}
68
69} // namespace iceberg
A namespace in a catalog.
Definition table_identifier.h:35
Identifies a table in iceberg catalog.
Definition table_identifier.h:46
Status Validate() const
Validates the TableIdentifier.
Definition table_identifier.h:55