lidavidm commented on code in PR #416:
URL: https://github.com/apache/arrow-adbc/pull/416#discussion_r1115810417


##########
rust/src/driver_manager.rs:
##########
@@ -0,0 +1,892 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! Load and use ADBC drivers.
+//!
+//! ## Loading a driver
+//!
+//! Drivers are initialized using a function provided by the driver as a main
+//! entrypoint, canonically called `AdbcDriverInit`. (Although many will use a
+//! different name to support statically linking multiple drivers within the
+//! same program.)
+//!
+//! To load from a function, use [AdbcDriver::load_from_init].
+//!
+//! To load from a dynamic library, use [AdbcDriver::load].
+//!
+//! ## Using across threads
+//!
+//! [AdbcDriver] and [AdbcDatabase] can be used across multiple threads. They
+//! hold their inner implementations within [std::sync::Arc], so they are
+//! cheaply copy-able.
+//!
+//! [AdbcConnection] should not be used across multiple threads. Driver
+//! implementations do not guarantee connection APIs are safe to call from
+//! multiple threads, unless calls are carefully sequenced. So instead of using
+//! the same connection across multiple threads, create a connection for each
+//! thread. [AdbcConnectionBuilder] is [core::marker::Send], so it can be moved
+//! to a new thread before initialized into an [AdbcConnection]. 
[AdbcConnection]
+//! holds it's inner data in a [std::rc::Rc], so it is also cheaply copyable.

Review Comment:
   I've wanted to implement async interfaces in general. That'll require some 
thought between Flight RPC, and Rust/C++/Go. (I want to make the C-level ABI in 
a way that all three languages can expose their native concurrency models 
efficiently, and import others' models efficiently. But that means I need to 
really go study up on how those models work.) I'd appreciate any thoughts you 
and @zeroshade have. 
   
   e.g.: gRPC C++ uses a callback-based model. UCX (in C) uses a polling-based 
model. There's precedent like kqueue/epoll, and of course the new io_uring 
(don't know if that's relevant). 
   
   There's also Python's model to consider (as a consumer), and probably we'd 
want to anticipate things like OpenTelemetry (or generally: non-stack-frame, 
non-thread based 'task' context). And eventually, whenever I get around to JNI 
bindings, Java's model as well (which, with virtual threading, is also getting 
more complicated/interesting).



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