File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -584,14 +584,14 @@ impl Connection {
584
584
Ok ( ( ) )
585
585
}
586
586
587
- fn wal_insert_frame ( & self , frame : & [ u8 ] ) -> Result < ( ) > {
587
+ fn wal_insert_frame ( & self , frame_no : u32 , frame : & [ u8 ] ) -> Result < ( ) > {
588
588
let mut conflict = 0i32 ;
589
589
let rc = unsafe {
590
590
libsql_sys:: ffi:: libsql_wal_insert_frame (
591
591
self . handle ( ) ,
592
- frame . len ( ) as u32 ,
592
+ frame_no ,
593
593
frame. as_ptr ( ) as * mut std:: ffi:: c_void ,
594
- 0 ,
594
+ frame . len ( ) as u32 ,
595
595
& mut conflict,
596
596
)
597
597
} ;
@@ -666,13 +666,13 @@ unsafe extern "C" fn authorizer_callback(
666
666
667
667
pub ( crate ) struct WalInsertHandle < ' a > {
668
668
conn : & ' a Connection ,
669
- in_session : RefCell < bool >
669
+ in_session : RefCell < bool > ,
670
670
}
671
671
672
672
impl WalInsertHandle < ' _ > {
673
- pub fn insert ( & self , frame : & [ u8 ] ) -> Result < ( ) > {
673
+ pub fn insert_at ( & self , frame_no : u32 , frame : & [ u8 ] ) -> Result < ( ) > {
674
674
assert ! ( * self . in_session. borrow( ) ) ;
675
- self . conn . wal_insert_frame ( frame)
675
+ self . conn . wal_insert_frame ( frame_no , frame)
676
676
}
677
677
678
678
pub fn begin ( & self ) -> Result < ( ) > {
Original file line number Diff line number Diff line change @@ -974,8 +974,8 @@ pub async fn try_pull(
974
974
) ;
975
975
return Err ( SyncError :: InvalidPullFrameBytes ( frames. len ( ) ) . into ( ) ) ;
976
976
}
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) ;
979
979
if let Err ( e) = r {
980
980
tracing:: error!(
981
981
"insert error (frame= {}) : {:?}" ,
You can’t perform that action at this time.
0 commit comments