diff --git a/src/dataStructure/filter.zig b/src/dataStructure/filter.zig index c7b6514..9ba31bd 100644 --- a/src/dataStructure/filter.zig +++ b/src/dataStructure/filter.zig @@ -312,8 +312,6 @@ pub const Filter = struct { else => unreachable, }, - // TODO: Also be able to it for array to array. Like names in ['something'] - // And it is true if at least one value are shared between array. .in => switch (condition.data_type) { .link => condition.value.link.contains(UUID{ .bytes = row_value.UUID }), .int => in(i32, row_value.Int, condition.value.int_array), diff --git a/src/dataStructure/relationMap.zig b/src/dataStructure/relationMap.zig index c7381c9..79bd045 100644 --- a/src/dataStructure/relationMap.zig +++ b/src/dataStructure/relationMap.zig @@ -16,8 +16,6 @@ // Then for each RelationMap, I parse the files again this time to update the first JSON that now have {<||>} // With a sub additionalData. If there is an additional data relation, I recurcive. // So I need an option in parseEntity to either write the first JSON or update the existing one -// -// FIXME: I think if 2 different struct have the same member name it can cause issue but maybe not tho const std = @import("std"); const AdditionalData = @import("additionalData.zig").AdditionalData; diff --git a/src/file/read.zig b/src/file/read.zig index f749e57..e1913de 100644 --- a/src/file/read.zig +++ b/src/file/read.zig @@ -190,9 +190,6 @@ pub fn parseEntities( var safe_allocator = std.heap.ThreadSafeAllocator{ .child_allocator = arena.allocator() }; const allocator = safe_allocator.allocator(); - var buff = std.ArrayList(u8).init(entry_allocator); - const writer = buff.writer(); - const sstruct = try self.schema_engine.structName2SchemaStruct(struct_name); const to_parse = try self.allFileIndex(allocator, struct_name); @@ -235,6 +232,9 @@ pub fn parseEntities( wg.wait(); // Append all writer to each other + var buff = std.ArrayList(u8).init(entry_allocator); + const writer = buff.writer(); + writer.writeByte('[') catch return ZipponError.WriteError; for (thread_writer_list) |list| writer.writeAll(list.items) catch return ZipponError.WriteError; writer.writeByte(']') catch return ZipponError.WriteError; diff --git a/src/file/write.zig b/src/file/write.zig index a14bd3f..050d9d0 100644 --- a/src/file/write.zig +++ b/src/file/write.zig @@ -268,7 +268,7 @@ pub fn deleteEntities( writer.writeByte(']') catch return ZipponError.WriteError; // FIXME: Stop doing that and just remove UUID from the map itself instead of reparsing everything at the end - // It's just that I can't do it in deleteEntitiesOneFile itself + // It's just that I can't do it in deleteEntitiesOneFile itself because of multi thread that update the map at same time sstruct.uuid_file_index.map.clearRetainingCapacity(); _ = sstruct.uuid_file_index.reset(); try self.populateFileIndexUUIDMap(sstruct, sstruct.uuid_file_index); diff --git a/src/test.zig b/src/test.zig index 698be8e..db1bc11 100644 --- a/src/test.zig +++ b/src/test.zig @@ -72,7 +72,7 @@ test "GRAB filter with string" { // OK test "GRAB with additional data" { // OK const db = DB{ .path = "test1", .schema = "schema/test" }; - try testParsing(db, "GRAB User [1] {age < 18}"); // FIXME: Return nothing + try testParsing(db, "GRAB User [1] {age < 18}"); try testParsing(db, "GRAB User [id, name] {age < 18}"); try testParsing(db, "GRAB User [100; name, age] {age < 18}"); } @@ -100,16 +100,15 @@ test "GRAB filter with date" { // OK try testParsing(db, "GRAB User {last_order > 2000/01/01-12:45}"); } -// FIXME: GRAB User [1] return nothing test "Specific query" { // NOT OK const db = DB{ .path = "test1", .schema = "schema/test" }; try testParsing(db, "GRAB User"); try testParsing(db, "GRAB User {}"); - try testParsing(db, "GRAB User [1]"); // FIXME: Return nothing + try testParsing(db, "GRAB User [1]"); try testParsing(db, "GRAB User [*, friends]"); } -test "Specific query ADD" { // OK +test "Specific query ADD" { // OK - Test if array and relationship are empty by default if not specify const db = DB{ .path = "test1", .schema = "schema/test" }; try testParsing(db, "ADD User (name = 'Bob1', email='bob@email.com', age=55, best_friend=none, friends=none, bday=2000/01/01, a_time=12:04, last_order=2000/01/01-12:45)"); try testParsing(db, "ADD User (name = 'Bob2', email='bob@email.com', age=55, best_friend=none, bday=2000/01/01, a_time=12:04, last_order=2000/01/01-12:45)"); diff --git a/src/thread/engine.zig b/src/thread/engine.zig index e8b8503..cf3b666 100644 --- a/src/thread/engine.zig +++ b/src/thread/engine.zig @@ -21,7 +21,7 @@ pub fn init(allocator: std.mem.Allocator) !ThreadEngine { const cpu_core = if (CPU_CORE == 0) std.Thread.getCpuCount() catch 1 else CPU_CORE; log.debug("Using {d} cpu core.", .{cpu_core}); - log.debug("Using {d}Mb stack size.", .{std.Thread.SpawnConfig.default_stack_size / 1024 / 1024}); + // log.debug("Using {d}Mb stack size.", .{std.Thread.SpawnConfig.default_stack_size / 1024 / 1024}); const thread_pool = try allocator.create(std.Thread.Pool); try thread_pool.init(std.Thread.Pool.Options{