Removed useless code and old comment
This commit is contained in:
+1
-1
@@ -150,7 +150,7 @@ pub fn parse(self: *Self, null_term_line_str: [:0]const u8) !bool {
|
||||
.string_literal => {
|
||||
const null_term_query_str = try allocator.dupeZ(u8, toker.buffer[token.loc.start + 1 .. token.loc.end - 1]);
|
||||
defer allocator.free(null_term_query_str);
|
||||
self.runQuery(null_term_query_str); // TODO: THis should return something and I should send from here, not from the parser
|
||||
self.runQuery(null_term_query_str); // This should most probably return something and I should send from here, not from the parser
|
||||
state = .end;
|
||||
},
|
||||
.keyword_help => {
|
||||
|
||||
@@ -4,8 +4,6 @@ const RelationMap = @import("relationMap.zig").RelationMap;
|
||||
const dtype = @import("dtype");
|
||||
const DataType = dtype.DataType;
|
||||
|
||||
// TODO: Put this in a data structure directory
|
||||
|
||||
const ZipponError = @import("error").ZipponError;
|
||||
|
||||
/// This is the [] part
|
||||
|
||||
@@ -52,7 +52,6 @@ pub fn createMainDirectories(self: *Self) ZipponError!void {
|
||||
}
|
||||
|
||||
/// Request a path to a schema file and then create the struct folder
|
||||
/// TODO: Check if some data already exist and if so ask if the user want to delete it and make a backup
|
||||
pub fn createStructDirectories(self: *Self, struct_array: []SchemaStruct) ZipponError!void {
|
||||
var data_dir = try self.printOpenDir("{s}/DATA", .{self.path_to_ZipponDB_dir}, .{});
|
||||
defer data_dir.close();
|
||||
|
||||
+1
-20
@@ -132,7 +132,6 @@ pub fn orderedNewData(
|
||||
}
|
||||
|
||||
/// Get the index of the first file that is bellow the size limit. If not found, create a new file
|
||||
/// TODO: Need some serious speed up. I should keep in memory a file->size as a hashmap and use that instead
|
||||
pub fn getFirstUsableIndexFile(self: Self, struct_name: []const u8) ZipponError!usize {
|
||||
var member_dir = try self.printOpenDir("{s}/DATA/{s}", .{ self.path_to_ZipponDB_dir, struct_name }, .{ .iterate = true });
|
||||
defer member_dir.close();
|
||||
@@ -144,7 +143,7 @@ pub fn getFirstUsableIndexFile(self: Self, struct_name: []const u8) ZipponError!
|
||||
const file_stat = member_dir.statFile(entry.name) catch return ZipponError.FileStatError;
|
||||
if (file_stat.size < config.MAX_FILE_SIZE) {
|
||||
// Cant I just return i ? It is supossed that files are ordered. I think I already check and it is not
|
||||
log.debug("{s}\n\n", .{entry.name});
|
||||
log.debug("First usable file found for `{s}`: {s}", .{ struct_name, entry.name });
|
||||
return std.fmt.parseInt(usize, entry.name[0..(entry.name.len - 4)], 10) catch return ZipponError.InvalidFileIndex; // INFO: Hardcoded len of file extension
|
||||
}
|
||||
}
|
||||
@@ -155,24 +154,6 @@ pub fn getFirstUsableIndexFile(self: Self, struct_name: []const u8) ZipponError!
|
||||
return i;
|
||||
}
|
||||
|
||||
/// Iterate over all file of a struct and return the index of the last file.
|
||||
/// E.g. a struct with 0.csv and 1.csv it return 1.
|
||||
/// FIXME: I use 0..file_index but because now I delete empty file, I can end up trying to parse an empty file. So I need to delete that
|
||||
/// And do something that return a list of file to parse instead
|
||||
pub fn maxFileIndex(self: Self, struct_name: []const u8) ZipponError!usize {
|
||||
var dir = try self.printOpenDir("{s}/DATA/{s}", .{ self.path_to_ZipponDB_dir, struct_name }, .{ .iterate = true });
|
||||
defer dir.close();
|
||||
|
||||
var count: usize = 0;
|
||||
|
||||
var iter = dir.iterate();
|
||||
while (iter.next() catch return ZipponError.DirIterError) |entry| {
|
||||
if (entry.kind != .file) continue;
|
||||
count += 1;
|
||||
}
|
||||
return count - 1;
|
||||
}
|
||||
|
||||
pub fn allFileIndex(self: Self, allocator: Allocator, struct_name: []const u8) ZipponError![]usize {
|
||||
var dir = try self.printOpenDir("{s}/DATA/{s}", .{ self.path_to_ZipponDB_dir, struct_name }, .{ .iterate = true });
|
||||
defer dir.close();
|
||||
|
||||
+1
-2
@@ -24,7 +24,6 @@ const log = std.log.scoped(.fileEngine);
|
||||
|
||||
var path_buffer: [1024]u8 = undefined;
|
||||
|
||||
// TODO: Make it in batch too
|
||||
pub fn addEntity(
|
||||
self: *Self,
|
||||
struct_name: []const u8,
|
||||
@@ -35,7 +34,7 @@ pub fn addEntity(
|
||||
defer arena.deinit();
|
||||
const allocator = arena.allocator();
|
||||
|
||||
var file_index = try self.getFirstUsableIndexFile(struct_name); // TODO: Speed up this
|
||||
var file_index = try self.getFirstUsableIndexFile(struct_name);
|
||||
var path = std.fmt.bufPrint(&path_buffer, "{s}/DATA/{s}/{d}.zid", .{ self.path_to_ZipponDB_dir, struct_name, file_index }) catch return ZipponError.MemoryError;
|
||||
|
||||
var data_writer = zid.DataWriter.init(path, null) catch return ZipponError.ZipponDataError;
|
||||
|
||||
@@ -210,7 +210,6 @@ pub fn parse(self: *Self, buffer: [:0]const u8) ZipponError!void {
|
||||
),
|
||||
},
|
||||
|
||||
// TODO: Optimize so it doesnt use parseFilter but just parse the file and directly check the condition. Here I end up parsing 2 times.
|
||||
.filter_and_update => switch (token.tag) {
|
||||
.l_brace => {
|
||||
var filter = try self.parseFilter(allocator, struct_name, false);
|
||||
|
||||
Reference in New Issue
Block a user