G-XD commented on code in PR #3233:
URL: 
https://github.com/apache/incubator-opendal/pull/3233#discussion_r1349531239


##########
core/src/services/libsql/backend.rs:
##########
@@ -0,0 +1,345 @@
+// 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.
+
+use std::collections::HashMap;
+use std::fmt::Debug;
+
+use async_trait::async_trait;
+use libsql_client::{args, Config, Statement, SyncClient, Value};

Review Comment:
   `Client` does not implement the `Sync` trait, so it will report an error 
when using it, how should I solve it?
   
   <details> <summary>msg</summary>
   
   ```plaintext
   error: future cannot be sent between threads safely
      --> core/src/services/libsql/backend.rs:286:65
       |
   286 |       async fn set(&self, path: &str, value: &[u8]) -> Result<()> {
       |  _________________________________________________________________^
   287 | |
   288 | |         let client = Client::from_config(self.get_config()?)
   289 | |             .await
   ...   |
   302 | |         Ok(())
   303 | |     }
       | |_____^ future created by async block is not `Send`
       |
       = help: within `libsql_client::Client`, the trait `Sync` is not 
implemented for `*mut libsql_sys::ffi::sqlite3`
   note: future is not `Send` as this value is used across an await
      --> core/src/services/libsql/backend.rs:299:13
       |
   297 |         client
       |         ------ has type `&libsql_client::Client` which is not `Send`
   298 |             .execute(Statement::with_args(query, args!(path, 
value.to_vec())))
   299 |             .await
       |             ^^^^^^ await occurs here, with `client` maybe used later
   300 |             .map_err(|err| Error::new(ErrorKind::Unexpected, "set 
failed").set_source(err))?;
       |                                                                        
                     - `client` is later dropped here
   help: consider moving this into a `let` binding to create a shorter lived 
borrow
      --> core/src/services/libsql/backend.rs:297:9
       |
   297 | /         client
   298 | |             .execute(Statement::with_args(query, args!(path, 
value.to_vec())))
       | 
|______________________________________________________________________________^
       = note: required for the cast from `[async 
block@core/src/services/libsql/backend.rs:286:65: 303:6]` to the object type 
`dyn futures::Future<Output = std::result::Result<(), types::error::Error>> + 
std::marker::Send`
   
   ```
   </details>



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