File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,6 +57,8 @@ pub enum Error {
5757 InvalidBlobSize ( usize ) ,
5858 #[ error( "sync error: {0}" ) ]
5959 Sync ( crate :: BoxError ) ,
60+ #[ error( "WAL frame insert conflict" ) ]
61+ WalConflict ,
6062}
6163
6264#[ cfg( feature = "hrana" ) ]
Original file line number Diff line number Diff line change @@ -539,20 +539,28 @@ impl Connection {
539539 }
540540
541541 fn wal_insert_frame ( & self , frame : & [ u8 ] ) -> Result < ( ) > {
542+ let mut conflict = 0i32 ;
542543 let rc = unsafe {
543544 libsql_sys:: ffi:: libsql_wal_insert_frame (
544545 self . handle ( ) ,
545546 frame. len ( ) as u32 ,
546547 frame. as_ptr ( ) as * mut std:: ffi:: c_void ,
547548 0 ,
549+ & mut conflict,
548550 )
549551 } ;
552+
550553 if rc != 0 {
551- return Err ( crate :: errors:: Error :: SqliteFailure (
554+ return Err ( errors:: Error :: SqliteFailure (
552555 rc as std:: ffi:: c_int ,
553- format ! ( "wal_insert_frame failed" ) ,
556+ "wal_insert_frame failed" . to_string ( ) ,
554557 ) ) ;
555558 }
559+
560+ if conflict != 0 {
561+ return Err ( errors:: Error :: WalConflict ) ;
562+ }
563+
556564 Ok ( ( ) )
557565 }
558566
You can’t perform that action at this time.
0 commit comments