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

Function GetObjectMetadata

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

Source from the content-addressed store, hash-verified

1346
1347template <typename ObjectResult>
1348std::shared_ptr<const KeyValueMetadata> GetObjectMetadata(const ObjectResult& result) {
1349 auto md = std::make_shared<KeyValueMetadata>();
1350
1351 auto push = [&](std::string k, const Aws::String& v) {
1352 if (!v.empty()) {
1353 md->Append(std::move(k), std::string(FromAwsString(v)));
1354 }
1355 };
1356 auto push_datetime = [&](std::string k, const Aws::Utils::DateTime& v) {
1357 if (v != Aws::Utils::DateTime(0.0)) {
1358 push(std::move(k), v.ToGmtString(Aws::Utils::DateFormat::ISO_8601));
1359 }
1360 };
1361
1362 md->Append("Content-Length", ToChars(result.GetContentLength()));
1363 push("Cache-Control", result.GetCacheControl());
1364 push("Content-Type", result.GetContentType());
1365 push("Content-Language", result.GetContentLanguage());
1366 push("ETag", result.GetETag());
1367 push("VersionId", result.GetVersionId());
1368 push_datetime("Last-Modified", result.GetLastModified());
1369 push_datetime("Expires", result.GetExpires());
1370 // NOTE the "canned ACL" isn't available for reading (one can get an expanded
1371 // ACL using a separate GetObjectAcl request)
1372 return md;
1373}
1374
1375template <typename ObjectRequest>
1376struct 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