alexandreyc commented on code in PR #1742:
URL: https://github.com/apache/arrow-adbc/pull/1742#discussion_r1575281649


##########
rust/core/src/ffi/types.rs:
##########
@@ -17,4 +17,622 @@
 
 #![allow(non_camel_case_types, non_snake_case)]
 
+use std::ffi::{CStr, CString};
+use std::mem::ManuallyDrop;
+use std::os::raw::{c_char, c_int, c_void};
+use std::ptr::{null, null_mut};
+
+use super::{check_status, constants, methods};
+use crate::{
+    error::{Error, Status},
+    Partitions,
+};
+
 pub type FFI_AdbcStatusCode = u8;
+
+/// A driver initialization function.
+pub type FFI_AdbcDriverInitFunc =
+    unsafe extern "C" fn(c_int, *mut c_void, *mut FFI_AdbcError) -> 
FFI_AdbcStatusCode;
+
+#[repr(C)]
+#[derive(Debug)]
+pub struct FFI_AdbcError {
+    message: *mut c_char,
+    vendor_code: i32,
+    sqlstate: [c_char; 5],
+    release: Option<unsafe extern "C" fn(*mut Self)>,
+    /// Added in ADBC 1.1.0.
+    pub(crate) private_data: *mut c_void,
+    /// Added in ADBC 1.1.0.
+    pub private_driver: *const FFI_AdbcDriver,
+}
+
+#[repr(C)]
+#[derive(Debug)]
+pub struct FFI_AdbcErrorDetail {
+    /// The metadata key.
+    pub(crate) key: *const c_char,
+    /// The binary metadata value.
+    pub(crate) value: *const u8,
+    /// The length of the metadata value.
+    pub(crate) value_length: usize,
+}
+
+#[repr(C)]
+#[derive(Debug)]
+pub struct FFI_AdbcDatabase {
+    /// Opaque implementation-defined state.
+    /// This field is NULLPTR iff the connection is unintialized/freed.
+    pub(crate) private_data: *mut c_void,
+    /// The associated driver (used by the driver manager to help track state).
+    pub(crate) private_driver: *const FFI_AdbcDriver,
+}
+
+unsafe impl Send for FFI_AdbcDatabase {}

Review Comment:
   Well, the reason I added this is to be able to wrap `FFI_AdbcDatabase` 
within a `Mutex` and make the result `Send` and `Sync`. This is useful in the 
driver manager. I think we can rediscuss this during the review of the driver 
manager because it's difficult to justify things without having a global view.
   



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