@@ -9,6 +9,11 @@ pub const MergedSegmentInfo = struct {
9
9
info : SegmentInfo = .{},
10
10
attributes : std .AutoHashMapUnmanaged (u64 , u64 ) = .{},
11
11
docs : std .AutoHashMapUnmanaged (u32 , bool ) = .{},
12
+
13
+ pub fn deinit (self : * MergedSegmentInfo , allocator : std.mem.Allocator ) void {
14
+ self .attributes .deinit (allocator );
15
+ self .docs .deinit (allocator );
16
+ }
12
17
};
13
18
14
19
pub fn SegmentMerger (comptime Segment : type ) type {
@@ -36,8 +41,8 @@ pub fn SegmentMerger(comptime Segment: type) type {
36
41
};
37
42
38
43
allocator : std.mem.Allocator ,
39
- sources : std .ArrayList (Source ),
40
44
collection : * SegmentList (Segment ),
45
+ sources : std .ArrayListUnmanaged (Source ) = .{},
41
46
segment : MergedSegmentInfo = .{},
42
47
estimated_size : usize = 0 ,
43
48
@@ -46,7 +51,6 @@ pub fn SegmentMerger(comptime Segment: type) type {
46
51
pub fn init (allocator : std.mem.Allocator , collection : * SegmentList (Segment )) Self {
47
52
return .{
48
53
.allocator = allocator ,
49
- .sources = std .ArrayList (Source ).init (allocator ),
50
54
.collection = collection ,
51
55
};
52
56
}
@@ -56,13 +60,13 @@ pub fn SegmentMerger(comptime Segment: type) type {
56
60
source .reader .close ();
57
61
source .skip_docs .deinit (self .allocator );
58
62
}
59
- self .sources .deinit ();
60
- self .segment .docs . deinit (self .allocator );
63
+ self .sources .deinit (self . allocator );
64
+ self .segment .deinit (self .allocator );
61
65
self .* = undefined ;
62
66
}
63
67
64
68
pub fn addSource (self : * Self , source : * Segment ) ! void {
65
- try self .sources .append (.{
69
+ try self .sources .append (self . allocator , .{
66
70
.reader = source .reader (),
67
71
});
68
72
}
0 commit comments