zeroshade commented on code in PR #2918:
URL: https://github.com/apache/arrow-adbc/pull/2918#discussion_r2129170723


##########
c/include/arrow-adbc/adbc_driver_manager.h:
##########
@@ -51,6 +63,52 @@ ADBC_EXPORT
 AdbcStatusCode AdbcLoadDriver(const char* driver_name, const char* entrypoint,
                               int version, void* driver, struct AdbcError* 
error);
 
+/// \brief Common entry point to search for and load a driver or manifest.
+///
+/// The driver manager can fill in default implementations of some ADBC 
functions
+/// for drivers. Drivers must implement a minimum level of functionality for 
this
+/// to be possible, however, and some functions must be implemented by the 
driver.
+///
+/// This function is different from AdbcLoadDriver in that it also accepts the 
name
+/// of a driver manifest file, and allows specifying options to control what
+/// directories it will search through. The behavior is as follows:
+///
+/// If the passed in driver_name is an absolute path:
+/// - If the path has a `.toml` extension, it will attempt to parse the 
manifest and load
+///   the driver specified within it. Erroring if this fails.
+/// - If the path has an extension other than `.toml`, it will attempt to load 
the path as
+///   a shared library. Erroring if this fails.
+///
+/// If the passed in driver_name does not have an extension and is not an 
absolute path:
+/// - The load_options parameter will control whether the driver manager will 
search
+///   the ADBC_CONFIG_PATH environment variable, the user configuration 
directory, and/or
+///   the system level directory of /etc/adbc for either a manifest file or a 
shared
+///   library.
+/// - For each path to be search, it will first look for 
<path>/<driver_name>.toml. If
+///   that file exists, it will attempt to parse the manifest and load the 
driver
+///   specified within it. Erroring if this fails.
+/// - If the manifest file does not exist, it will then look for
+/// <path>/<driver_name>.<extension>
+///   where <extension> is one of the following: `.so`, `.dll`, `.dylib`. If 
it can load
+///   that shared library, then success is returned. Otherwise it moves to the 
next
+///   directory until the search is either successful, or all directories have 
been
+///   searched.
+///
+/// \param[in] driver_name An identifier for the driver (e.g. a path to a
+///   shared library on Linux or the basename of a manifest file).
+/// \param[in] entrypoint  An identifier for the entrypoint (e.g. the symbol to
+///   call for AdbcDriverInitFunc on Linux).  If not provided, search for an
+///   entrypoint based on the driver name.
+/// \param[in] version The ADBC revision to attempt to initialize.
+/// \param[in] load_options bit mask of AdbcLoadOption to control the 
directories searched
+/// \param[out] raw_driver The table of function pointers to initialize
+/// \param[out] error An optional location to return an error message
+/// @return
+ADBC_EXPORT
+AdbcStatusCode AdbcFindLoadDriver(const char* driver_name, const char* 
entrypoint,
+                                  const int version, const AdbcLoadOption 
load_options,
+                                  void* driver, struct AdbcError* error);

Review Comment:
   I was explicitly trying to avoid having it take the `const char** 
search_path` and was leaving the environment variable as the escape hatch. Part 
of the point was to limit where it would search and just have the env var as 
the escape hatch. 
   
   I can add that though if there's consensus that we should provide that. 
@pitrou @felipecrv @lidavidm what do you think?



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to