wgtmac commented on code in PR #105:
URL: https://github.com/apache/iceberg-cpp/pull/105#discussion_r2100391479


##########
src/iceberg/avro/avro_stream_internal.h:
##########
@@ -0,0 +1,98 @@
+/*
+ * 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 <arrow/io/interfaces.h>
+#include <avro/Stream.hh>
+
+namespace iceberg::avro {
+
+class AvroInputStream : public ::avro::SeekableInputStream {
+ public:
+  explicit AvroInputStream(std::shared_ptr<::arrow::io::RandomAccessFile> 
input_stream,
+                           int64_t buffer_size);
+
+  ~AvroInputStream() override;
+
+  /// \brief Returns some of available data.
+  /// \return true if some data is available, false if no more data is 
available or an
+  /// error has occurred.
+  bool next(const uint8_t** data, size_t* len) override;
+
+  /// \brief "Returns" back some of the data to the stream. The returned data 
must be less
+  /// than what was obtained in the last call to next().
+  void backup(size_t len) override;

Review Comment:
   This is a public interface from avro-cpp. IIRC, it internally reads a large 
chunk into the buffer and then backup some if read too much to reduce I/O.



-- 
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: issues-unsubscr...@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to