iceberg-cpp
Loading...
Searching...
No Matches
inheritable_metadata.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 <cstdint>
26#include <memory>
27#include <string>
28
29#include "iceberg/iceberg_export.h"
30#include "iceberg/result.h"
31#include "iceberg/type_fwd.h"
32
33namespace iceberg {
34
40class ICEBERG_EXPORT InheritableMetadata {
41 public:
42 virtual ~InheritableMetadata();
43
47 virtual Status Apply(ManifestEntry& entry) = 0;
48};
49
52class ICEBERG_EXPORT BaseInheritableMetadata : public InheritableMetadata {
53 public:
59 BaseInheritableMetadata(int32_t spec_id, int64_t snapshot_id, int64_t sequence_number,
60 std::string manifest_location);
61
62 Status Apply(ManifestEntry& entry) override;
63
64 ~BaseInheritableMetadata() override;
65
66 private:
67 int32_t spec_id_;
68 int64_t snapshot_id_;
69 int64_t sequence_number_;
70 std::string manifest_location_;
71};
72
74class ICEBERG_EXPORT EmptyInheritableMetadata : public InheritableMetadata {
75 public:
76 Status Apply(ManifestEntry& entry) override;
77
79};
80
82class ICEBERG_EXPORT CopyInheritableMetadata : public InheritableMetadata {
83 public:
86 explicit CopyInheritableMetadata(int64_t snapshot_id);
87
88 Status Apply(ManifestEntry& entry) override;
89
90 ~CopyInheritableMetadata() override;
91
92 private:
93 int64_t snapshot_id_;
94};
95
97class ICEBERG_EXPORT InheritableMetadataFactory {
98 public:
100 static Result<std::unique_ptr<InheritableMetadata>> Empty();
101
105 static Result<std::unique_ptr<InheritableMetadata>> FromManifest(
106 const ManifestFile& manifest);
107
111 static Result<std::unique_ptr<InheritableMetadata>> ForCopy(int64_t snapshot_id);
112
113 private:
114 InheritableMetadataFactory() = default;
115};
116
117} // namespace iceberg
Base implementation of InheritableMetadata that handles standard inheritance rules.
Definition inheritable_metadata.h:52
Metadata inheritance for copying manifests before commit.
Definition inheritable_metadata.h:82
Empty implementation that applies no inheritance.
Definition inheritable_metadata.h:74
Factory for creating InheritableMetadata instances.
Definition inheritable_metadata.h:97
Interface for applying inheritable metadata to manifest entries.
Definition inheritable_metadata.h:40
virtual Status Apply(ManifestEntry &entry)=0
Apply inheritable metadata to a manifest entry.
A manifest is an immutable Avro file that lists data files or delete files, along with each file's pa...
Definition manifest_entry.h:307
Entry in a manifest list.
Definition manifest_list.h:85