taoseng commented on code in PR #6119:
URL: https://github.com/apache/opendal/pull/6119#discussion_r2066313076
##########
bindings/c/src/reader.rs:
##########
@@ -72,6 +76,33 @@ impl opendal_reader {
}
}
+ /// \brief Seek to an offset, in bytes, in a stream.
+ #[no_mangle]
+ pub unsafe extern "C" fn opendal_reader_seek(
+ &mut self,
+ offset: i64,
+ whence: i32,
+ ) -> *mut opendal_error {
+ let pos = match whence {
+ _x @ OPENDAL_SEEK_SET => SeekFrom::Start(offset as u64),
+ _x @ OPENDAL_SEEK_CUR => SeekFrom::Current(offset),
+ _x @ OPENDAL_SEEK_END => SeekFrom::End(offset),
+ _ => {
+ return opendal_error::new(core::Error::new(
+ core::ErrorKind::Unexpected,
+ "undefined whence",
+ ))
+ }
+ };
+
+ match self.deref_mut().seek(pos) {
+ Ok(_) => std::ptr::null_mut(),
+ Err(e) => {
+
opendal_error::new(core::Error::new(core::ErrorKind::Unexpected, e.to_string()))
+ }
Review Comment:
thanks for your suggestions, i had made the changes.
--
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]