MCPcopy Create free account
hub / github.com/apache/arrow / GetObjectMetadata

Function GetObjectMetadata

cpp/src/arrow/filesystem/s3fs.cc:1288–1313  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1286
1287template <typename ObjectResult>
1288std::shared_ptr<const KeyValueMetadata> GetObjectMetadata(const ObjectResult& result) {
1289 auto md = std::make_shared<KeyValueMetadata>();
1290
1291 auto push = [&](std::string k, const Aws::String& v) {
1292 if (!v.empty()) {
1293 md->Append(std::move(k), std::string(FromAwsString(v)));
1294 }
1295 };
1296 auto push_datetime = [&](std::string k, const Aws::Utils::DateTime& v) {
1297 if (v != Aws::Utils::DateTime(0.0)) {
1298 push(std::move(k), v.ToGmtString(Aws::Utils::DateFormat::ISO_8601));
1299 }
1300 };
1301
1302 md->Append("Content-Length", ToChars(result.GetContentLength()));
1303 push("Cache-Control", result.GetCacheControl());
1304 push("Content-Type", result.GetContentType());
1305 push("Content-Language", result.GetContentLanguage());
1306 push("ETag", result.GetETag());
1307 push("VersionId", result.GetVersionId());
1308 push_datetime("Last-Modified", result.GetLastModified());
1309 push_datetime("Expires", result.GetExpires());
1310 // NOTE the "canned ACL" isn't available for reading (one can get an expanded
1311 // ACL using a separate GetObjectAcl request)
1312 return md;
1313}
1314
1315template <typename ObjectRequest>
1316struct ObjectMetadataSetter {

Callers 1

InitMethod · 0.85

Calls 5

FromAwsStringFunction · 0.85
ToCharsFunction · 0.85
emptyMethod · 0.45
AppendMethod · 0.45
GetContentLengthMethod · 0.45

Tested by

no test coverage detected