silver-ymz commented on code in PR #3004:
URL: 
https://github.com/apache/incubator-opendal/pull/3004#discussion_r1315539974


##########
bindings/cpp/include/opendal.hpp:
##########
@@ -176,4 +188,45 @@ class Operator {
   std::optional<rust::Box<opendal::ffi::Operator>> operator_;
 };
 
+/**
+ * @class Reader
+ * @brief Reader is designed to read data from the operator.
+ * @details It provides basic read and seek operations. If you want to use it
+ * like a stream, you can use `ReaderStream` instead.
+ * @code{.cpp}
+ * auto reader = operator.reader("path");
+ * opendal::ReaderStream stream(reader);
+ * @endcode
+ */
+class Reader
+    : public boost::iostreams::device<boost::iostreams::input_seekable> {
+public:
+  // Users should not use this type directly.
+  using InternalReader = rust::Box<opendal::ffi::Reader>;
+
+  Reader(InternalReader &&reader) : reader_(std::move(reader)) {}
+
+  std::streamsize read(void *s, std::streamsize n);
+  std::streampos seek(std::streamoff off, std::ios_base::seekdir way);
+
+private:
+  InternalReader reader_;

Review Comment:
   > InternalReader is not cool to me, can we use rust::Box<xxx> here directly?
   
   Yes, we can.



-- 
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