From b2bd1e373b27ab3de689e791437943da27cfb53c Mon Sep 17 00:00:00 2001 From: MrBounty Date: Thu, 23 Jan 2025 17:31:41 +0100 Subject: [PATCH] Updated lib config and small stuff --- .gitignore | 3 +++ README.md | 2 +- lib/config.zig | 4 ++-- lib/config_benchmark.zig | 4 ++-- schema/benchmark | 3 ++- schema/test | 11 +++++++++++ schema/{3struct => test-3struct} | 0 7 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 schema/test rename schema/{3struct => test-3struct} (100%) diff --git a/.gitignore b/.gitignore index d160a4b..c85bcf6 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,6 @@ engine.o zig-out test1 test2 +fly.toml +dockerfile +.dockerignore diff --git a/README.md b/README.md index 622c3f1..7061b9f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ![alt text](https://github.com/MrBounty/ZipponDB/blob/main/docs/images/banner.png) -ZipponDB is a relational database written entirely in Zig from scratch with 0 dependencies. +ZipponDB is a database written entirely in Zig from scratch with 0 dependencies. ZipponDB's goal is to be ACID, light, simple, and high-performance. It aims at small to medium applications that don't need fancy features but a simple and reliable database. diff --git a/lib/config.zig b/lib/config.zig index 8968e79..b7a7339 100644 --- a/lib/config.zig +++ b/lib/config.zig @@ -1,6 +1,6 @@ pub const BUFFER_SIZE = 1024 * 10; // Used a bit everywhere. The size for the schema for example. 10kB -pub const MAX_FILE_SIZE = 1024 * 1024; // 1MB -pub const CPU_CORE = 0; +pub const MAX_FILE_SIZE = 1024 * 1024 * 5; // Tried multiple MAX_FILE_SIZE and found 5Mb is good +pub const CPU_CORE = 0; // If 0, take maximum using std.Thread.getCpuCount() // Debug pub const PRINT_STATE = false; diff --git a/lib/config_benchmark.zig b/lib/config_benchmark.zig index 764bbda..a54aab6 100644 --- a/lib/config_benchmark.zig +++ b/lib/config_benchmark.zig @@ -1,5 +1,5 @@ pub const BUFFER_SIZE = 1024 * 1024; // Used a bit everywhere. The size for the schema for example. 10kB -pub const MAX_FILE_SIZE = 1024 * 1024; // 1MB +pub const MAX_FILE_SIZE = 1024 * 1024 * 5; // Tried multiple MAX_FILE_SIZE and found 5Mb is good pub const CPU_CORE = 16; // Debug @@ -17,7 +17,7 @@ pub const HELP_MESSAGE = struct { \\run To run a query. \\db Create or chose a database. \\schema Initialize the database schema. - \\dump To export data in other format and backup. + \\dump To export data in other format and backup. (experimental) \\quit Stop the CLI with memory safety. \\ \\For more informations: https://mrbounty.github.io/ZipponDB/cli diff --git a/schema/benchmark b/schema/benchmark index 84a9f5f..1c6f6ed 100644 --- a/schema/benchmark +++ b/schema/benchmark @@ -1,12 +1,13 @@ User ( name: str, email: str, - orders: []Order, ) Order ( items: []Item, + quantity: []int, at: datetime, + from: User, ) Item ( diff --git a/schema/test b/schema/test new file mode 100644 index 0000000..ca397b2 --- /dev/null +++ b/schema/test @@ -0,0 +1,11 @@ +User ( + name: str, + age: int, + email: str, + bday: date, + last_order: datetime, + a_time: time, + scores: []int, + best_friend: User, + friends: []User, +) diff --git a/schema/3struct b/schema/test-3struct similarity index 100% rename from schema/3struct rename to schema/test-3struct