1515// specific language governing permissions and limitations
1616// under the License.
1717
18- use pyo3:: prelude:: * ;
1918use crate :: * ;
20- use std:: sync:: Arc ;
2119use pyo3_async_runtimes:: tokio:: future_into_py;
20+ use std:: sync:: Arc ;
2221
2322/// Connection to a Fluss cluster
2423#[ pyclass]
@@ -37,55 +36,55 @@ impl FlussConnection {
3736 let connection = fcore:: client:: FlussConnection :: new ( rust_config)
3837 . await
3938 . map_err ( |e| FlussError :: new_err ( e. to_string ( ) ) ) ?;
40-
39+
4140 let py_connection = FlussConnection {
4241 inner : Arc :: new ( connection) ,
4342 } ;
4443
45- Python :: with_gil ( |py| {
46- Py :: new ( py, py_connection)
47- } )
44+ Python :: with_gil ( |py| Py :: new ( py, py_connection) )
4845 } )
4946 }
50-
47+
5148 /// Get admin interface
5249 fn get_admin < ' py > ( & self , py : Python < ' py > ) -> PyResult < Bound < ' py , PyAny > > {
5350 let client = self . inner . clone ( ) ;
5451
5552 future_into_py ( py, async move {
56- let admin = client. get_admin ( )
53+ let admin = client
54+ . get_admin ( )
5755 . await
5856 . map_err ( |e| FlussError :: new_err ( e. to_string ( ) ) ) ?;
5957
6058 let py_admin = FlussAdmin :: from_core ( admin) ;
6159
62- Python :: with_gil ( |py| {
63- Py :: new ( py, py_admin)
64- } )
60+ Python :: with_gil ( |py| Py :: new ( py, py_admin) )
6561 } )
6662 }
6763
6864 /// Get a table
69- fn get_table < ' py > ( & self , py : Python < ' py > , table_path : & TablePath ) -> PyResult < Bound < ' py , PyAny > > {
65+ fn get_table < ' py > (
66+ & self ,
67+ py : Python < ' py > ,
68+ table_path : & TablePath ,
69+ ) -> PyResult < Bound < ' py , PyAny > > {
7070 let client = self . inner . clone ( ) ;
7171 let core_path = table_path. to_core ( ) . clone ( ) ;
7272
7373 future_into_py ( py, async move {
74- let core_table = client. get_table ( & core_path)
74+ let core_table = client
75+ . get_table ( & core_path)
7576 . await
7677 . map_err ( |e| FlussError :: new_err ( e. to_string ( ) ) ) ?;
77-
78+
7879 let py_table = FlussTable :: new_table (
79- client,
80- core_table. metadata ,
81- core_table. table_info ,
82- core_table. table_path ,
83- core_table. has_primary_key ,
80+ client. clone ( ) ,
81+ core_table. metadata ( ) . clone ( ) ,
82+ core_table. table_info ( ) . clone ( ) ,
83+ core_table. table_path ( ) . clone ( ) ,
84+ core_table. has_primary_key ( ) ,
8485 ) ;
8586
86- Python :: with_gil ( |py| {
87- Py :: new ( py, py_table)
88- } )
87+ Python :: with_gil ( |py| Py :: new ( py, py_table) )
8988 } )
9089 }
9190
@@ -98,7 +97,7 @@ impl FlussConnection {
9897 fn __enter__ ( slf : PyRef < Self > ) -> PyRef < Self > {
9998 slf
10099 }
101-
100+
102101 // Exit the runtime context (for 'with' statement)
103102 #[ pyo3( signature = ( _exc_type=None , _exc_value=None , _traceback=None ) ) ]
104103 fn __exit__ (
0 commit comments