Write-ahead log with fsync batching for Eio
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

wal: Format wal.ml

+8 -4
+8 -4
lib/wal.ml
··· 114 114 (* Get file size to append at end *) 115 115 let stat = Eio.Path.stat ~follow:true path in 116 116 let file_size = stat.size in 117 - let block_offset = Optint.Int63.(to_int (rem file_size (of_int block_size))) in 117 + let block_offset = 118 + Optint.Int63.(to_int (rem file_size (of_int block_size))) 119 + in 118 120 { 119 - file = (file :> Eio.File.rw_ty Eio.Resource.t); 121 + file :> Eio.File.rw_ty Eio.Resource.t; 120 122 block_offset; 121 123 file_offset = file_size; 122 124 } ··· 135 137 let padding = String.make block_remaining '\x00' in 136 138 Eio.File.pwrite_all t.file ~file_offset:t.file_offset 137 139 [ Cstruct.of_string padding ]; 138 - t.file_offset <- Optint.Int63.add t.file_offset (Optint.Int63.of_int block_remaining); 140 + t.file_offset <- 141 + Optint.Int63.add t.file_offset (Optint.Int63.of_int block_remaining); 139 142 t.block_offset <- 0; 140 143 write_fragments data_offset is_first 141 144 end ··· 155 158 Eio.File.pwrite_all t.file ~file_offset:t.file_offset 156 159 [ Cstruct.of_string record ]; 157 160 let record_len = String.length record in 158 - t.file_offset <- Optint.Int63.add t.file_offset (Optint.Int63.of_int record_len); 161 + t.file_offset <- 162 + Optint.Int63.add t.file_offset (Optint.Int63.of_int record_len); 159 163 t.block_offset <- t.block_offset + record_len; 160 164 if t.block_offset >= block_size then t.block_offset <- 0; 161 165 write_fragments (data_offset + fragment_len) false