This is an automated email from the ASF dual-hosted git repository.
zeroshade pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git
The following commit(s) were added to refs/heads/main by this push:
new 65afee931 feat(rust/driver_manager): make some functions and modules
pub instead of pub(crate) (#4052)
65afee931 is described below
commit 65afee9316dc3a81c825c01dff1110c833a50cb9
Author: Matt Topol <[email protected]>
AuthorDate: Mon Mar 9 10:39:32 2026 -0400
feat(rust/driver_manager): make some functions and modules pub instead of
pub(crate) (#4052)
To facilitate more reuse of the functions for locating drivers,
searching for manifests, and loading drivers directly, it makes sense to
make some of the functionality directly public instead of being only
`pub(crate)`. This will allow consumers to have more reuse of the
components in the driver_manager (which I believe was the intent of the
previous refactor in the first place).
This includes `SearchHit`, `process_profile_value`, `DriverLibrary` and
some of the searching/loading methods of `DriverLibrary`.
---
rust/driver_manager/src/lib.rs | 3 ++-
rust/driver_manager/src/profile.rs | 2 +-
rust/driver_manager/src/search.rs | 14 +++++++-------
3 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/rust/driver_manager/src/lib.rs b/rust/driver_manager/src/lib.rs
index 439cb27e6..26304b792 100644
--- a/rust/driver_manager/src/lib.rs
+++ b/rust/driver_manager/src/lib.rs
@@ -102,7 +102,7 @@
pub mod error;
pub mod profile;
-pub(crate) mod search;
+pub mod search;
use std::collections::HashSet;
use std::ffi::{CString, OsStr};
@@ -271,6 +271,7 @@ impl ManagedDriver {
let driver = self.inner_ffi_driver();
let mut database = adbc_ffi::FFI_AdbcDatabase::default();
+ database.private_driver = driver;
// DatabaseNew
let mut error = adbc_ffi::FFI_AdbcError::with_driver(driver);
let method = driver_method!(*driver, DatabaseNew);
diff --git a/rust/driver_manager/src/profile.rs
b/rust/driver_manager/src/profile.rs
index 40a668d2f..5d4946e3e 100644
--- a/rust/driver_manager/src/profile.rs
+++ b/rust/driver_manager/src/profile.rs
@@ -336,7 +336,7 @@ fn profile_value_regex() -> &'static Regex {
RE.get_or_init(|| Regex::new(r"\{\{\s*([^{}]*?)\s*\}\}").unwrap())
}
-pub(crate) fn process_profile_value(value: &str) -> Result<OptionValue> {
+pub fn process_profile_value(value: &str) -> Result<OptionValue> {
let re = profile_value_regex();
let replacer = |caps: &Captures| -> Result<String> {
diff --git a/rust/driver_manager/src/search.rs
b/rust/driver_manager/src/search.rs
index e3476e00d..904daabb0 100644
--- a/rust/driver_manager/src/search.rs
+++ b/rust/driver_manager/src/search.rs
@@ -182,7 +182,7 @@ impl DriverInfo {
}
}
-pub(crate) struct SearchHit {
+pub struct SearchHit {
/// The path where `library` was loaded from.
pub lib_path: PathBuf,
/// The loaded library.
@@ -237,7 +237,7 @@ impl<'a> ops::Deref for DriverInitFunc<'a> {
}
}
-pub(crate) struct DriverLibrary<'a> {
+pub struct DriverLibrary<'a> {
init: DriverInitFunc<'a>,
}
@@ -248,7 +248,7 @@ impl<'a> DriverLibrary<'a> {
}
}
- pub(crate) fn try_from_dynamic_library(
+ pub fn try_from_dynamic_library(
library: &'a libloading::Library,
entrypoint: &[u8],
) -> Result<Self> {
@@ -263,7 +263,7 @@ impl<'a> DriverLibrary<'a> {
}
/// Initialize the driver via the library's entrypoint.
- pub(crate) fn init_driver(&self, version: AdbcVersion) ->
Result<FFI_AdbcDriver> {
+ pub fn init_driver(&self, version: AdbcVersion) -> Result<FFI_AdbcDriver> {
let mut error = FFI_AdbcError::default();
let mut driver = FFI_AdbcDriver::default();
let status = unsafe {
@@ -277,7 +277,7 @@ impl<'a> DriverLibrary<'a> {
Ok(driver)
}
- pub(crate) fn load_library(filename: impl AsRef<OsStr>) ->
Result<libloading::Library> {
+ pub fn load_library(filename: impl AsRef<OsStr>) ->
Result<libloading::Library> {
// By default, go builds the libraries with '-Wl -z nodelete' which
does not
// unload the go runtime. This isn't respected on mac (
https://github.com/golang/go/issues/11100#issuecomment-932638093 )
// so we need to explicitly load the library with RTLD_NODELETE( which
prevents unloading )
@@ -368,7 +368,7 @@ impl<'a> DriverLibrary<'a> {
}
}
- pub(crate) fn search(
+ pub fn search(
name: impl AsRef<OsStr>,
load_flags: LoadFlags,
additional_search_paths: Option<Vec<PathBuf>>,
@@ -920,7 +920,7 @@ fn get_profile_search_paths(additional_path_list:
Option<Vec<PathBuf>>) -> Vec<P
PathBuf::from(conda_prefix)
.join("etc")
.join("adbc")
- .join("drivers"),
+ .join("profiles"),
);
}