Apache OpenDALâ„¢ C++ Binding
The C++ binding for Apache OpenDALâ„¢
Loading...
Searching...
No Matches
data_structure.hpp
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 <chrono>
23#include <cstdint>
24#include <optional>
25#include <string>
26
27namespace opendal {
28
33enum class EntryMode : int {
34 FILE = 1,
35 DIR = 2,
36 UNKNOWN = 0,
37};
38
49class Metadata {
50 public:
51 // Basic file information
53 std::uint64_t content_length{0};
54
55 // HTTP-style headers
56 std::optional<std::string>
58 std::optional<std::string>
61 std::optional<std::string>
63 std::optional<std::string>
65 std::optional<std::string>
67 std::optional<std::string> etag;
68 std::optional<std::chrono::system_clock::time_point>
70
71 // Versioning information
72 std::optional<std::string>
74 std::optional<bool> is_current;
75 bool is_deleted{false};
76
77 // Default constructor
78 Metadata() = default;
79
80 // Destructor
81 ~Metadata() = default;
82
83 // Accessor methods
84
89 EntryMode Mode() const { return type; }
90
95 bool IsFile() const { return type == EntryMode::FILE; }
96
101 bool IsDir() const { return type == EntryMode::DIR; }
102
107 std::uint64_t ContentLength() const { return content_length; }
108
113 const std::optional<std::string>& CacheControl() const {
114 return cache_control;
115 }
116
121 const std::optional<std::string>& ContentDisposition() const {
122 return content_disposition;
123 }
124
129 const std::optional<std::string>& ContentMd5() const {
130 return content_md5;
131 }
132
137 const std::optional<std::string>& ContentType() const {
138 return content_type;
139 }
140
145 const std::optional<std::string>& ContentEncoding() const {
146 return content_encoding;
147 }
148
153 const std::optional<std::string>& Etag() const { return etag; }
154
159 const std::optional<std::chrono::system_clock::time_point>& LastModified()
160 const {
161 return last_modified;
162 }
163
168 const std::optional<std::string>& Version() const { return version; }
169
175 const std::optional<bool>& IsCurrent() const { return is_current; }
176
181 bool IsDeleted() const { return is_deleted; }
182};
183
188class Entry {
189 public:
190 std::string path;
191};
192
193} // namespace opendal
194namespace opendal {
230}
Definition data_structure.hpp:195
size_t write_total_max_size
Definition data_structure.hpp:215
bool write_can_multi
Definition data_structure.hpp:207
bool write
Definition data_structure.hpp:206
bool presign_write
Definition data_structure.hpp:227
bool list_with_recursive
Definition data_structure.hpp:223
bool read
Definition data_structure.hpp:200
bool stat
Definition data_structure.hpp:197
bool read_with_if_match
Definition data_structure.hpp:201
bool stat_with_if_none_match
Definition data_structure.hpp:199
bool read_with_if_none_match
Definition data_structure.hpp:202
bool list_with_start_after
Definition data_structure.hpp:222
bool presign
Definition data_structure.hpp:224
bool copy
Definition data_structure.hpp:218
bool create_dir
Definition data_structure.hpp:216
bool list_with_limit
Definition data_structure.hpp:221
bool read_with_override_cache_control
Definition data_structure.hpp:203
size_t write_multi_max_size
Definition data_structure.hpp:213
bool presign_stat
Definition data_structure.hpp:226
bool rename
Definition data_structure.hpp:219
size_t write_multi_min_size
Definition data_structure.hpp:214
bool write_can_append
Definition data_structure.hpp:209
bool write_with_cache_control
Definition data_structure.hpp:212
bool stat_with_if_match
Definition data_structure.hpp:198
bool write_can_empty
Definition data_structure.hpp:208
bool delete_feature
Definition data_structure.hpp:217
bool list
Definition data_structure.hpp:220
bool shared
Definition data_structure.hpp:228
bool presign_read
Definition data_structure.hpp:225
bool write_with_content_disposition
Definition data_structure.hpp:211
bool write_with_content_type
Definition data_structure.hpp:210
bool read_with_override_content_disposition
Definition data_structure.hpp:204
bool read_with_override_content_type
Definition data_structure.hpp:205
The entry of a file or directory.
Definition data_structure.hpp:188
std::string path
Definition data_structure.hpp:190
The metadata of a file or directory.
Definition data_structure.hpp:49
std::optional< std::string > content_disposition
Definition data_structure.hpp:59
const std::optional< std::string > & CacheControl() const
Cache control directive.
Definition data_structure.hpp:113
EntryMode type
Definition data_structure.hpp:52
std::optional< std::chrono::system_clock::time_point > last_modified
Last-Modified timestamp.
Definition data_structure.hpp:69
const std::optional< std::string > & ContentDisposition() const
Content disposition.
Definition data_structure.hpp:121
std::optional< std::string > etag
ETag header as defined by RFC 7232.
Definition data_structure.hpp:67
std::optional< std::string > cache_control
Cache-Control header as defined by RFC 7234.
Definition data_structure.hpp:57
const std::optional< bool > & IsCurrent() const
Check if this is the current version.
Definition data_structure.hpp:175
bool IsDeleted() const
Check if this entry has been deleted.
Definition data_structure.hpp:181
std::optional< std::string > content_type
Content-Type header as defined by RFC 9110.
Definition data_structure.hpp:64
Metadata()=default
~Metadata()=default
EntryMode Mode() const
Get the entry mode (file type)
Definition data_structure.hpp:89
bool IsDir() const
Check if this metadata represents a directory.
Definition data_structure.hpp:101
std::optional< std::string > version
Version identifier (e.g., S3 version ID)
Definition data_structure.hpp:73
const std::optional< std::string > & ContentType() const
Content type (MIME type)
Definition data_structure.hpp:137
std::optional< std::string > content_encoding
Content-Encoding header as defined by RFC 7231.
Definition data_structure.hpp:66
const std::optional< std::string > & ContentEncoding() const
Content encoding.
Definition data_structure.hpp:145
const std::optional< std::string > & ContentMd5() const
Content MD5 hash.
Definition data_structure.hpp:129
std::uint64_t content_length
Definition data_structure.hpp:53
std::optional< bool > is_current
Whether this is the current version.
Definition data_structure.hpp:74
const std::optional< std::string > & Version() const
Version identifier.
Definition data_structure.hpp:168
std::optional< std::string > content_md5
Content-MD5 hash (deprecated but widely used)
Definition data_structure.hpp:62
std::uint64_t ContentLength() const
Content length in bytes.
Definition data_structure.hpp:107
const std::optional< std::chrono::system_clock::time_point > & LastModified() const
Last modified timestamp.
Definition data_structure.hpp:159
const std::optional< std::string > & Etag() const
ETag.
Definition data_structure.hpp:153
bool is_deleted
Whether this entry has been marked as deleted.
Definition data_structure.hpp:75
bool IsFile() const
Check if this metadata represents a file.
Definition data_structure.hpp:95
Definition data_structure.hpp:27
EntryMode
The mode of the entry.
Definition data_structure.hpp:33