File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -584,14 +584,14 @@ impl Connection {
584584 Ok ( ( ) )
585585 }
586586
587- fn wal_insert_frame ( & self , frame : & [ u8 ] ) -> Result < ( ) > {
587+ fn wal_insert_frame ( & self , frame_no : u32 , frame : & [ u8 ] ) -> Result < ( ) > {
588588 let mut conflict = 0i32 ;
589589 let rc = unsafe {
590590 libsql_sys:: ffi:: libsql_wal_insert_frame (
591591 self . handle ( ) ,
592- frame . len ( ) as u32 ,
592+ frame_no ,
593593 frame. as_ptr ( ) as * mut std:: ffi:: c_void ,
594- 0 ,
594+ frame . len ( ) as u32 ,
595595 & mut conflict,
596596 )
597597 } ;
@@ -666,13 +666,13 @@ unsafe extern "C" fn authorizer_callback(
666666
667667pub ( crate ) struct WalInsertHandle < ' a > {
668668 conn : & ' a Connection ,
669- in_session : RefCell < bool >
669+ in_session : RefCell < bool > ,
670670}
671671
672672impl WalInsertHandle < ' _ > {
673- pub fn insert ( & self , frame : & [ u8 ] ) -> Result < ( ) > {
673+ pub fn insert_at ( & self , frame_no : u32 , frame : & [ u8 ] ) -> Result < ( ) > {
674674 assert ! ( * self . in_session. borrow( ) ) ;
675- self . conn . wal_insert_frame ( frame)
675+ self . conn . wal_insert_frame ( frame_no , frame)
676676 }
677677
678678 pub fn begin ( & self ) -> Result < ( ) > {
Original file line number Diff line number Diff line change @@ -974,8 +974,8 @@ pub async fn try_pull(
974974 ) ;
975975 return Err ( SyncError :: InvalidPullFrameBytes ( frames. len ( ) ) . into ( ) ) ;
976976 }
977- for chunk in frames. chunks ( FRAME_SIZE ) {
978- let r = insert_handle. insert ( & chunk) ;
977+ for ( i , chunk) in frames. chunks ( FRAME_SIZE ) . enumerate ( ) {
978+ let r = insert_handle. insert_at ( frame_no + i as u32 , & chunk) ;
979979 if let Err ( e) = r {
980980 tracing:: error!(
981981 "insert error (frame= {}) : {:?}" ,
You can’t perform that action at this time.
0 commit comments