File tree Expand file tree Collapse file tree 3 files changed +17
-5
lines changed Expand file tree Collapse file tree 3 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -424,7 +424,17 @@ cfg_sync! {
424
424
425
425
let path = path. to_str( ) . ok_or( crate :: Error :: InvalidUTF8Path ) ?. to_owned( ) ;
426
426
427
+ let https = super :: connector( ) ?;
428
+ use tower:: ServiceExt ;
429
+
430
+ let svc = https
431
+ . map_err( |e| e. into( ) )
432
+ . map_response( |s| Box :: new( s) as Box <dyn crate :: util:: Socket >) ;
433
+
434
+ let connector = crate :: util:: ConnectorService :: new( svc) ;
435
+
427
436
let db = crate :: local:: Database :: open_local_with_offline_writes(
437
+ connector,
428
438
path,
429
439
flags,
430
440
url,
Original file line number Diff line number Diff line change @@ -131,6 +131,7 @@ impl Database {
131
131
#[ cfg( feature = "sync" ) ]
132
132
#[ doc( hidden) ]
133
133
pub async fn open_local_with_offline_writes (
134
+ connector : crate :: util:: ConnectorService ,
134
135
db_path : impl Into < String > ,
135
136
flags : OpenFlags ,
136
137
endpoint : String ,
@@ -144,6 +145,7 @@ impl Database {
144
145
} ;
145
146
let mut db = Database :: open ( & db_path, flags) ?;
146
147
db. sync_ctx = Some ( tokio:: sync:: Mutex :: new ( SyncContext :: new (
148
+ connector,
147
149
endpoint,
148
150
Some ( auth_token) ,
149
151
) ) ) ;
Original file line number Diff line number Diff line change 1
- use crate :: Result ;
1
+ use crate :: { util :: ConnectorService , Result } ;
2
2
use bytes:: Bytes ;
3
- use hyper:: { client :: HttpConnector , Body } ;
3
+ use hyper:: Body ;
4
4
5
5
const DEFAULT_MAX_RETRIES : usize = 5 ;
6
6
@@ -9,13 +9,13 @@ pub struct SyncContext {
9
9
auth_token : Option < String > ,
10
10
max_retries : usize ,
11
11
durable_frame_num : u32 ,
12
- client : hyper:: Client < HttpConnector , Body > ,
12
+ client : hyper:: Client < ConnectorService , Body > ,
13
13
}
14
14
15
15
impl SyncContext {
16
- pub fn new ( sync_url : String , auth_token : Option < String > ) -> Self {
16
+ pub fn new ( connector : ConnectorService , sync_url : String , auth_token : Option < String > ) -> Self {
17
17
// TODO(lucio): add custom connector + tls support here
18
- let client = hyper:: client:: Client :: builder ( ) . build_http :: < hyper:: Body > ( ) ;
18
+ let client = hyper:: client:: Client :: builder ( ) . build :: < _ , hyper:: Body > ( connector ) ;
19
19
20
20
Self {
21
21
sync_url,
You can’t perform that action at this time.
0 commit comments