pitrou commented on a change in pull request #11550:
URL: https://github.com/apache/arrow/pull/11550#discussion_r743108272



##########
File path: cpp/src/arrow/filesystem/gcsfs_internal.cc
##########
@@ -62,6 +65,133 @@ Status ToArrowStatus(const google::cloud::Status& s) {
   return Status::OK();
 }
 
+namespace gcs = ::google::cloud::storage;
+
+Result<google::cloud::storage::EncryptionKey> ToEncryptionKey(
+    const std::shared_ptr<const KeyValueMetadata>& metadata) {
+  if (!metadata) {
+    return gcs::EncryptionKey{};
+  }
+
+  const auto& keys = metadata->keys();
+  const auto& values = metadata->values();
+
+  for (std::size_t i = 0; i < keys.size(); ++i) {
+    if (keys[i] == "encryptionKeyBase64") {
+      return gcs::EncryptionKey::FromBase64Key(values[i]);
+    }
+  }
+  return gcs::EncryptionKey{};
+}
+
+Result<gcs::KmsKeyName> ToKmsKeyName(
+    const std::shared_ptr<const KeyValueMetadata>& metadata) {
+  if (!metadata) {
+    return gcs::KmsKeyName{};
+  }
+
+  const auto& keys = metadata->keys();
+  const auto& values = metadata->values();
+
+  for (std::size_t i = 0; i < keys.size(); ++i) {
+    if (keys[i] == "kmsKeyName") {
+      return gcs::KmsKeyName(values[i]);
+    }
+  }
+  return gcs::KmsKeyName{};
+}
+
+Result<gcs::PredefinedAcl> ToPredefinedAcl(
+    const std::shared_ptr<const KeyValueMetadata>& metadata) {
+  if (!metadata) {
+    return gcs::PredefinedAcl{};
+  }
+
+  const auto& keys = metadata->keys();
+  const auto& values = metadata->values();
+
+  for (std::size_t i = 0; i < keys.size(); ++i) {
+    if (keys[i] == "predefinedAcl") {
+      return gcs::PredefinedAcl(values[i]);
+    }
+  }
+  return gcs::PredefinedAcl{};
+}
+
+Result<gcs::WithObjectMetadata> ToObjectMetadata(
+    const std::shared_ptr<const KeyValueMetadata>& metadata) {
+  if (!metadata) {
+    return gcs::WithObjectMetadata{};
+  }
+
+  static auto const setters = [] {
+    using setter = std::function<Status(gcs::ObjectMetadata&, const 
std::string&)>;
+    return std::map<std::string, setter>{
+        {"cacheControl",

Review comment:
       Well, the concern here is to have a common vocabulary where possible. If 
the user can spell `{"Content-Type": "text/html"}` regardless of the filesystem 
type, it's better than having to special-case the metadata key name.
   
   As for the exact spelling, well, S3 has the precedence here since it was 
implemented first :-) The fact that the names may also match HTTP header names 
actually makes them well-known to users, so that's not a problem  IMHO.
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to