iceberg-cpp
Loading...
Searching...
No Matches
puffin_format.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 <array>
26#include <cstdint>
27#include <span>
28
29#include "iceberg/iceberg_data_export.h"
31#include "iceberg/result.h"
32
33namespace iceberg::puffin {
34
36struct ICEBERG_DATA_EXPORT PuffinFormat {
38 static constexpr std::array<uint8_t, 4> kMagicV1 = {0x50, 0x46, 0x41, 0x31};
39
40 static constexpr int32_t kMagicLength = 4;
41 static constexpr int32_t kFooterStartMagicOffset = 0;
42 static constexpr int32_t kFooterStartMagicLength = kMagicLength;
43 static constexpr int32_t kFooterStructPayloadSizeOffset = 0;
44 static constexpr int32_t kFooterStructFlagsOffset = kFooterStructPayloadSizeOffset + 4;
45 static constexpr int32_t kFooterStructFlagsLength = 4;
46 static constexpr int32_t kFooterStructMagicOffset =
47 kFooterStructFlagsOffset + kFooterStructFlagsLength;
48
50 static constexpr int32_t kFooterStructLength = kFooterStructMagicOffset + kMagicLength;
51
53 static constexpr PuffinCompressionCodec kDefaultFooterCompressionCodec =
54 PuffinCompressionCodec::kLz4;
55};
56
58enum class PuffinFlag : uint8_t {
61};
62
64ICEBERG_DATA_EXPORT bool IsFlagSet(std::span<const uint8_t, 4> flags, PuffinFlag flag);
65
67ICEBERG_DATA_EXPORT void SetFlag(std::span<uint8_t, 4> flags, PuffinFlag flag);
68
69} // namespace iceberg::puffin
PuffinCompressionCodec
Compression codecs supported by Puffin files.
Definition file_metadata.h:38
PuffinFlag
Footer flags for Puffin files.
Definition puffin_format.h:58
@ kFooterPayloadCompressed
Whether the footer payload is compressed.
Puffin file format constants.
Definition puffin_format.h:36