dentiny commented on code in PR #7645:
URL: https://github.com/apache/opendal/pull/7645#discussion_r3328716009
##########
bindings/c/src/metadata.rs:
##########
@@ -134,4 +143,29 @@ impl opendal_metadata {
Some(time) => time.into_inner().as_millisecond(),
}
}
+
+ /// \brief Return the version of the metadata, or NULL if not available.
+ ///
+ /// The caller must free the returned string with opendal_string_free().
+ #[no_mangle]
+ pub extern "C" fn opendal_metadata_version(&self) -> *mut c_char {
+ match self.deref().version() {
+ None => std::ptr::null_mut(),
+ Some(v) => CString::new(v)
+ .expect("CString::new failed in opendal_metadata_version")
+ .into_raw(),
+ }
+ }
+
+ /// \brief Return whether this metadata represents the current version.
Review Comment:
I'm not sure using -1 is a good practice for C. For example, IO libcalls
usually use -1 to indicate error. :thinking_face:
--
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]