lordgamez commented on code in PR #2167:
URL: https://github.com/apache/nifi-minifi-cpp/pull/2167#discussion_r3304780968


##########
extensions/aws/s3/MinifiToAwsInputStream.h:
##########
@@ -0,0 +1,60 @@
+/**
+ *
+ * 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 <streambuf>
+#include <iostream>
+#include <memory>
+#include <vector>
+
+#include "utils/ConfigurationUtils.h"
+#include "minifi-cpp/io/InputStream.h"
+#include "minifi-cpp/utils/gsl.h"
+
+namespace org::apache::nifi::minifi::aws::s3 {
+
+class MinifiInputStreamBuf : public std::streambuf {
+ public:
+  MinifiInputStreamBuf(std::shared_ptr<io::InputStream> stream, uint64_t 
content_length, gsl::not_null<std::basic_ios<char>*> owner)
+      : stream_(std::move(stream)),
+        start_pos_(stream_->tell()),
+        content_length_(content_length),
+        buffer_(utils::configuration::DEFAULT_BUFFER_SIZE),
+        owner_(owner) {}
+
+ protected:
+  int_type underflow() override;
+  pos_type seekoff(off_type off, std::ios_base::seekdir way, 
std::ios_base::openmode which) override;
+  pos_type seekpos(pos_type pos, std::ios_base::openmode which) override;
+
+ private:
+  std::shared_ptr<io::InputStream> stream_;
+  uint64_t start_pos_;
+  uint64_t content_length_;
+  std::vector<char> buffer_;
+  gsl::not_null<std::basic_ios<char>*> owner_;
+};
+
+class MinifiToAwsInputStream : private MinifiInputStreamBuf, public 
std::basic_iostream<char> {

Review Comment:
   But regardless how the AWS SDK defines these types, it's a good point that 
we should shorten these types in our context. It probably didn't occur to me 
because I was checking the AWS defined types and it was explicit there. I think 
it does not make a difference if that was generated by AI or not, if it's a 
valid comment as in this case, then it should be addressed by the author. 
Updated in 
https://github.com/apache/nifi-minifi-cpp/pull/2167/commits/18863d9b7899de9483af0aeff986d481c60dcf8d



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to