| 1435 | |
| 1436 | template <typename ObjectRequest> |
| 1437 | Status SetObjectMetadata(const std::shared_ptr<const KeyValueMetadata>& metadata, |
| 1438 | ObjectRequest* req) { |
| 1439 | static auto setters = ObjectMetadataSetter<ObjectRequest>::GetSetters(); |
| 1440 | |
| 1441 | DCHECK_NE(metadata, nullptr); |
| 1442 | const auto& keys = metadata->keys(); |
| 1443 | const auto& values = metadata->values(); |
| 1444 | |
| 1445 | for (size_t i = 0; i < keys.size(); ++i) { |
| 1446 | auto it = setters.find(keys[i]); |
| 1447 | if (it != setters.end()) { |
| 1448 | RETURN_NOT_OK(it->second(values[i], req)); |
| 1449 | } |
| 1450 | } |
| 1451 | return Status::OK(); |
| 1452 | } |
| 1453 | |
| 1454 | bool IsDirectory(std::string_view key, const S3Model::HeadObjectResult& result) { |
| 1455 | // If it has a non-zero length, it's a regular file. We do this even if |