File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -342,6 +342,28 @@ cfg_replication! {
342342 crate :: util:: ConnectorService :: new( svc)
343343 } ;
344344
345+ let client = hyper:: client:: Client :: builder( )
346+ . build:: <_, hyper:: Body >( connector. clone( ) ) ;
347+
348+ let req = http:: Request :: get( format!( "{url}/sync/0/0/0" ) )
349+ . header( "Authorization" , format!( "Bearer {}" , auth_token) )
350+ . body( hyper:: Body :: empty( ) )
351+ . unwrap( ) ;
352+
353+ let res = client
354+ . request( req)
355+ . await
356+ . map_err( |err| crate :: Error :: Sync ( err. into( ) ) ) ?;
357+
358+ match res. status( ) {
359+ hyper:: StatusCode :: OK => return Builder :: new_synced_database( path, url, auth_token)
360+ . remote_writes( true )
361+ . read_your_writes( read_your_writes)
362+ . build( )
363+ . await ,
364+ _ => { }
365+ }
366+
345367 let path = path. to_str( ) . ok_or( crate :: Error :: InvalidUTF8Path ) ?. to_owned( ) ;
346368
347369 let db = if !skip_safety_assert {
You can’t perform that action at this time.
0 commit comments