File tree 1 file changed +4
-3
lines changed
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ files: std.ArrayList(FileInfo),
26
26
27
27
current_file : ? std.fs.File = null ,
28
28
current_file_size : usize = 0 ,
29
- max_file_size : usize = 1_000_000 ,
29
+ max_file_size : usize = 16 * 1024 * 1024 ,
30
30
31
31
next_commit_id : u64 = 1 ,
32
32
@@ -208,7 +208,8 @@ pub fn write(self: *Self, changes: []const Change) !u64 {
208
208
const commit_id = self .next_commit_id ;
209
209
210
210
const file = try self .getFile (commit_id );
211
- var bufferred_writer = std .io .bufferedWriter (file .writer ());
211
+ var counting_writer = std .io .countingWriter (file .writer ());
212
+ var bufferred_writer = std .io .bufferedWriter (counting_writer .writer ());
212
213
const writer = bufferred_writer .writer ();
213
214
214
215
try msgpack .encode (Transaction {
@@ -218,7 +219,7 @@ pub fn write(self: *Self, changes: []const Change) !u64 {
218
219
219
220
try bufferred_writer .flush ();
220
221
221
- self .current_file_size += changes . len ;
222
+ self .current_file_size += counting_writer . bytes_written ;
222
223
self .next_commit_id += 1 ;
223
224
224
225
file .sync () catch | err | {
You can’t perform that action at this time.
0 commit comments