lordgamez commented on a change in pull request #975: URL: https://github.com/apache/nifi-minifi-cpp/pull/975#discussion_r568565231
########## File path: extensions/aws/processors/DeleteS3Object.cpp ########## @@ -30,6 +30,11 @@ namespace minifi { namespace aws { namespace processors { +const core::Property DeleteS3Object::ObjectKey( + core::PropertyBuilder::createProperty("Object Key") + ->withDescription("The key of the S3 object. If none is given the filename attribute will be used by default.") + ->supportsExpressionLanguage(true) + ->build()); Review comment: Are you referring to the `${filename}` attribute value? In the PutS3Object processor we removed that default value on purpose and used this implementation to support users who do not have expression language support. This is why I used the same method here. ########## File path: extensions/aws/s3/S3ClientRequestSender.h ########## @@ -0,0 +1,47 @@ +/** + * @file S3Wrapper.h + * S3Wrapper class declaration + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#include "S3RequestSender.h" + +namespace org { +namespace apache { +namespace nifi { +namespace minifi { +namespace aws { +namespace s3 { + +class S3ClientRequestSender : public S3RequestSender { + public: + minifi::utils::optional<Aws::S3::Model::PutObjectResult> sendPutObjectRequest(const Aws::S3::Model::PutObjectRequest& request) override; + bool sendDeleteObjectRequest(const Aws::S3::Model::DeleteObjectRequest& request) override; + minifi::utils::optional<Aws::S3::Model::GetObjectResult> sendGetObjectRequest(const Aws::S3::Model::GetObjectRequest& request) override; + minifi::utils::optional<Aws::S3::Model::ListObjectsV2Result> sendListObjectsRequest(const Aws::S3::Model::ListObjectsV2Request& request) override; + minifi::utils::optional<Aws::S3::Model::ListObjectVersionsResult> sendListVersionsRequest(const Aws::S3::Model::ListObjectVersionsRequest& request) override; + minifi::utils::optional<Aws::S3::Model::GetObjectTaggingResult> sendGetObjectTaggingRequest(const Aws::S3::Model::GetObjectTaggingRequest& request) override; + minifi::utils::optional<Aws::S3::Model::HeadObjectResult> sendHeadObjectRequest(const Aws::S3::Model::HeadObjectRequest& request) override; +}; Review comment: The ListS3 processor is supposed to be the last S3 processor for the time being, I'm not sure if we have any additional S3 functionality in the future. Do you have any particular use case in mind for the async API? In that case I suppose we should have the same async API in the S3Wrapper as well, to be able to get the processor-desired result in an async way. In my opinion we should only invest in implementing and testing an async API when we have a use case for it, I'm not sure if it would be worth right now. ########## File path: extensions/aws/s3/S3ClientRequestSender.h ########## @@ -0,0 +1,47 @@ +/** + * @file S3Wrapper.h + * S3Wrapper class declaration + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#include "S3RequestSender.h" + +namespace org { +namespace apache { +namespace nifi { +namespace minifi { +namespace aws { +namespace s3 { + +class S3ClientRequestSender : public S3RequestSender { + public: + minifi::utils::optional<Aws::S3::Model::PutObjectResult> sendPutObjectRequest(const Aws::S3::Model::PutObjectRequest& request) override; + bool sendDeleteObjectRequest(const Aws::S3::Model::DeleteObjectRequest& request) override; + minifi::utils::optional<Aws::S3::Model::GetObjectResult> sendGetObjectRequest(const Aws::S3::Model::GetObjectRequest& request) override; + minifi::utils::optional<Aws::S3::Model::ListObjectsV2Result> sendListObjectsRequest(const Aws::S3::Model::ListObjectsV2Request& request) override; + minifi::utils::optional<Aws::S3::Model::ListObjectVersionsResult> sendListVersionsRequest(const Aws::S3::Model::ListObjectVersionsRequest& request) override; + minifi::utils::optional<Aws::S3::Model::GetObjectTaggingResult> sendGetObjectTaggingRequest(const Aws::S3::Model::GetObjectTaggingRequest& request) override; + minifi::utils::optional<Aws::S3::Model::HeadObjectResult> sendHeadObjectRequest(const Aws::S3::Model::HeadObjectRequest& request) override; +}; Review comment: I think the async API could help us in a way that currently we always wait for the request to finish because of the `s3_wrapper_mutex_` which helps to avoid overwriting client configuration of the S3 client in concurrent `onTrigger` calls. Because of the mutex only 1 request can run at a time, and you are right that making the client async, waiting for the result could be done afterwards. Another solution I was thinking about is making the S3Wrapper stateless and passing all the configuration parameters to every single call, making it thread safe to call `onTrigger` function parallel which would create separate clients with separate configurations. What do you think? ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org