From dbd7073345b4599779aa6e3d58c865889a255f7f Mon Sep 17 00:00:00 2001 From: RayBipse Date: Sun, 18 Feb 2024 16:53:24 -0800 Subject: [PATCH] Renamed repo to eggshell --- CMakeLists.txt | 18 +++++++++--------- README.md | 10 +++++----- .../compiler/executeresult.hpp | 0 .../compiler/metacmd/metacmd.hpp | 6 +++--- .../compiler/metacmd/metacmdresult.hpp | 0 .../{modeldb => eggshell}/compiler/parser.hpp | 0 .../compiler/prepareresult.hpp | 0 .../compiler/statement.hpp | 8 ++++---- .../storage/bplus/internalnode.hpp | 2 +- .../storage/bplus/leafnode.hpp | 4 ++-- .../storage/bplus/node.hpp | 6 +++--- .../storage/bplus/nodetype.hpp | 0 .../{modeldb => eggshell}/storage/cursor.hpp | 2 +- .../{modeldb => eggshell}/storage/pager.hpp | 0 include/{modeldb => eggshell}/storage/row.hpp | 0 .../{modeldb => eggshell}/storage/table.hpp | 4 ++-- src/compiler/metacmd/metacmd.cpp | 12 ++++++------ src/compiler/parser.cpp | 2 +- src/compiler/statement.cpp | 4 ++-- src/repl.cpp | 8 ++++---- src/storage/bplus/internalnode.cpp | 8 ++++---- src/storage/bplus/leafnode.cpp | 6 +++--- src/storage/bplus/node.cpp | 6 +++--- src/storage/cursor.cpp | 4 ++-- src/storage/pager.cpp | 2 +- src/storage/row.cpp | 2 +- src/storage/table.cpp | 8 ++++---- tests/btree_test.cpp | 2 +- 28 files changed, 62 insertions(+), 62 deletions(-) rename include/{modeldb => eggshell}/compiler/executeresult.hpp (100%) rename include/{modeldb => eggshell}/compiler/metacmd/metacmd.hpp (65%) rename include/{modeldb => eggshell}/compiler/metacmd/metacmdresult.hpp (100%) rename include/{modeldb => eggshell}/compiler/parser.hpp (100%) rename include/{modeldb => eggshell}/compiler/prepareresult.hpp (100%) rename include/{modeldb => eggshell}/compiler/statement.hpp (67%) rename include/{modeldb => eggshell}/storage/bplus/internalnode.hpp (97%) rename include/{modeldb => eggshell}/storage/bplus/leafnode.hpp (93%) rename include/{modeldb => eggshell}/storage/bplus/node.hpp (85%) rename include/{modeldb => eggshell}/storage/bplus/nodetype.hpp (100%) rename include/{modeldb => eggshell}/storage/cursor.hpp (92%) rename include/{modeldb => eggshell}/storage/pager.hpp (100%) rename include/{modeldb => eggshell}/storage/row.hpp (100%) rename include/{modeldb => eggshell}/storage/table.hpp (81%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 42f8537..7ac56dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.22) -project("modeldb") +project("eggshell") # setting version set(CMAKE_CXX_STANDARD 20) @@ -7,20 +7,20 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) # add library -file(GLOB_RECURSE MODELDB_SRC "src/*.cpp" "src/*.hpp") -file(GLOB_RECURSE MODELDB_INCLUDE "include/modeldb/*.hpp") -add_library(modeldb SHARED ${MODELDB_SRC} ${MODELDB_INCLUDE}) +file(GLOB_RECURSE EGGSHELL_SRC "src/*.cpp" "src/*.hpp") +file(GLOB_RECURSE EGGSHELL_INCLUDE "include/eggshell/*.hpp") +add_library(eggshell SHARED ${EGGSHELL_SRC} ${EGGSHELL_INCLUDE}) # set include directories -# target_include_directories(modeldb PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/modeldb) -# target_include_directories(modeldb PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src) -target_include_directories(modeldb PUBLIC +# target_include_directories(eggshell PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/eggshell) +# target_include_directories(eggshell PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src) +target_include_directories(eggshell PUBLIC $ $ ) add_executable(repl "src/repl.cpp") -target_link_libraries(repl PUBLIC modeldb) +target_link_libraries(repl PUBLIC eggshell) # testing enable_testing() @@ -34,7 +34,7 @@ set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) FetchContent_MakeAvailable(googletest) add_executable(btree_test tests/btree_test.cpp) -target_link_libraries(btree_test GTest::gtest_main modeldb) +target_link_libraries(btree_test GTest::gtest_main eggshell) include(GoogleTest) gtest_discover_tests(btree_test) \ No newline at end of file diff --git a/README.md b/README.md index 3d55662..65ef0d9 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# ModelDB +# Eggshell DB -![workflow badge](https://github.com/RayBipse/modeldb/actions/workflows/build.yml/badge.svg) +![workflow badge](https://github.com/RayBipse/eggshell-db/actions/workflows/build.yml/badge.svg) Relational database model built in C++, written as a learning project. -ModelDB could support concurrent read and write operations. It utilizes a readers-writer lock. +Eggshell could support concurrent read and write operations. It utilizes a readers-writer lock. It could also support atomicity, as previous pages are logged before they are modified. @@ -24,7 +24,7 @@ SELECT column1, column2 FROM table_name; The library is broken down into two sections, ``compiler`` and ``storage``, where the ``compiler`` composes inputs into commands and ``storage`` is responsible for storing data. -![toydb architecture](https://github.com/RayBipse/modeldb/assets/46636772/58b72c59-f472-4196-996e-73b286745e36) +![toydb architecture](https://github.com/RayBipse/eggshell/assets/46636772/58b72c59-f472-4196-996e-73b286745e36) ## Usage @@ -61,7 +61,7 @@ Some features to be implemented in the future are ## Tests -ModelDB uses [Google Test](https://github.com/google/googletest), which is simple to configure and run. +eggshell uses [Google Test](https://github.com/google/googletest), which is simple to configure and run. To test, run the following command after building: ```zsh diff --git a/include/modeldb/compiler/executeresult.hpp b/include/eggshell/compiler/executeresult.hpp similarity index 100% rename from include/modeldb/compiler/executeresult.hpp rename to include/eggshell/compiler/executeresult.hpp diff --git a/include/modeldb/compiler/metacmd/metacmd.hpp b/include/eggshell/compiler/metacmd/metacmd.hpp similarity index 65% rename from include/modeldb/compiler/metacmd/metacmd.hpp rename to include/eggshell/compiler/metacmd/metacmd.hpp index 66aa432..879e489 100644 --- a/include/modeldb/compiler/metacmd/metacmd.hpp +++ b/include/eggshell/compiler/metacmd/metacmd.hpp @@ -3,9 +3,9 @@ #include #include -#include "modeldb/compiler/metacmd/metacmdresult.hpp" -#include "modeldb/storage/pager.hpp" -#include "modeldb/storage/table.hpp" +#include "eggshell/compiler/metacmd/metacmdresult.hpp" +#include "eggshell/storage/pager.hpp" +#include "eggshell/storage/table.hpp" void print_constants(); diff --git a/include/modeldb/compiler/metacmd/metacmdresult.hpp b/include/eggshell/compiler/metacmd/metacmdresult.hpp similarity index 100% rename from include/modeldb/compiler/metacmd/metacmdresult.hpp rename to include/eggshell/compiler/metacmd/metacmdresult.hpp diff --git a/include/modeldb/compiler/parser.hpp b/include/eggshell/compiler/parser.hpp similarity index 100% rename from include/modeldb/compiler/parser.hpp rename to include/eggshell/compiler/parser.hpp diff --git a/include/modeldb/compiler/prepareresult.hpp b/include/eggshell/compiler/prepareresult.hpp similarity index 100% rename from include/modeldb/compiler/prepareresult.hpp rename to include/eggshell/compiler/prepareresult.hpp diff --git a/include/modeldb/compiler/statement.hpp b/include/eggshell/compiler/statement.hpp similarity index 67% rename from include/modeldb/compiler/statement.hpp rename to include/eggshell/compiler/statement.hpp index 7f84540..21b063c 100644 --- a/include/modeldb/compiler/statement.hpp +++ b/include/eggshell/compiler/statement.hpp @@ -2,10 +2,10 @@ #include -#include "modeldb/compiler/executeresult.hpp" -#include "modeldb/compiler/prepareresult.hpp" -#include "modeldb/storage/row.hpp" -#include "modeldb/storage/table.hpp" +#include "eggshell/compiler/executeresult.hpp" +#include "eggshell/compiler/prepareresult.hpp" +#include "eggshell/storage/row.hpp" +#include "eggshell/storage/table.hpp" enum class StatementType { insert, select }; diff --git a/include/modeldb/storage/bplus/internalnode.hpp b/include/eggshell/storage/bplus/internalnode.hpp similarity index 97% rename from include/modeldb/storage/bplus/internalnode.hpp rename to include/eggshell/storage/bplus/internalnode.hpp index f73222d..55163d1 100644 --- a/include/modeldb/storage/bplus/internalnode.hpp +++ b/include/eggshell/storage/bplus/internalnode.hpp @@ -2,7 +2,7 @@ #include -#include "modeldb/storage/table.hpp" +#include "eggshell/storage/table.hpp" namespace InternalNode { diff --git a/include/modeldb/storage/bplus/leafnode.hpp b/include/eggshell/storage/bplus/leafnode.hpp similarity index 93% rename from include/modeldb/storage/bplus/leafnode.hpp rename to include/eggshell/storage/bplus/leafnode.hpp index 3ddc5e5..1a5bb83 100644 --- a/include/modeldb/storage/bplus/leafnode.hpp +++ b/include/eggshell/storage/bplus/leafnode.hpp @@ -2,8 +2,8 @@ #include -#include "modeldb/storage/cursor.hpp" -#include "modeldb/storage/row.hpp" +#include "eggshell/storage/cursor.hpp" +#include "eggshell/storage/row.hpp" namespace LeafNode { diff --git a/include/modeldb/storage/bplus/node.hpp b/include/eggshell/storage/bplus/node.hpp similarity index 85% rename from include/modeldb/storage/bplus/node.hpp rename to include/eggshell/storage/bplus/node.hpp index 610b924..81f1f1a 100644 --- a/include/modeldb/storage/bplus/node.hpp +++ b/include/eggshell/storage/bplus/node.hpp @@ -2,9 +2,9 @@ #include -#include "modeldb/storage/bplus/nodetype.hpp" -#include "modeldb/storage/cursor.hpp" -#include "modeldb/storage/table.hpp" +#include "eggshell/storage/bplus/nodetype.hpp" +#include "eggshell/storage/cursor.hpp" +#include "eggshell/storage/table.hpp" namespace Node { diff --git a/include/modeldb/storage/bplus/nodetype.hpp b/include/eggshell/storage/bplus/nodetype.hpp similarity index 100% rename from include/modeldb/storage/bplus/nodetype.hpp rename to include/eggshell/storage/bplus/nodetype.hpp diff --git a/include/modeldb/storage/cursor.hpp b/include/eggshell/storage/cursor.hpp similarity index 92% rename from include/modeldb/storage/cursor.hpp rename to include/eggshell/storage/cursor.hpp index c9ab06c..cdc116d 100644 --- a/include/modeldb/storage/cursor.hpp +++ b/include/eggshell/storage/cursor.hpp @@ -5,7 +5,7 @@ #include #include -#include "modeldb/storage/table.hpp" +#include "eggshell/storage/table.hpp" struct Table; diff --git a/include/modeldb/storage/pager.hpp b/include/eggshell/storage/pager.hpp similarity index 100% rename from include/modeldb/storage/pager.hpp rename to include/eggshell/storage/pager.hpp diff --git a/include/modeldb/storage/row.hpp b/include/eggshell/storage/row.hpp similarity index 100% rename from include/modeldb/storage/row.hpp rename to include/eggshell/storage/row.hpp diff --git a/include/modeldb/storage/table.hpp b/include/eggshell/storage/table.hpp similarity index 81% rename from include/modeldb/storage/table.hpp rename to include/eggshell/storage/table.hpp index 94680fb..eb36eda 100644 --- a/include/modeldb/storage/table.hpp +++ b/include/eggshell/storage/table.hpp @@ -5,8 +5,8 @@ #include #include -#include "modeldb/storage/cursor.hpp" -#include "modeldb/storage/pager.hpp" +#include "eggshell/storage/cursor.hpp" +#include "eggshell/storage/pager.hpp" struct Cursor; diff --git a/src/compiler/metacmd/metacmd.cpp b/src/compiler/metacmd/metacmd.cpp index 96ebc6a..44243c4 100644 --- a/src/compiler/metacmd/metacmd.cpp +++ b/src/compiler/metacmd/metacmd.cpp @@ -1,12 +1,12 @@ -#include "modeldb/compiler/metacmd/metacmd.hpp" +#include "eggshell/compiler/metacmd/metacmd.hpp" #include -#include "modeldb/compiler/metacmd/metacmdresult.hpp" -#include "modeldb/storage/bplus/internalnode.hpp" -#include "modeldb/storage/bplus/leafnode.hpp" -#include "modeldb/storage/bplus/node.hpp" -#include "modeldb/storage/row.hpp" +#include "eggshell/compiler/metacmd/metacmdresult.hpp" +#include "eggshell/storage/bplus/internalnode.hpp" +#include "eggshell/storage/bplus/leafnode.hpp" +#include "eggshell/storage/bplus/node.hpp" +#include "eggshell/storage/row.hpp" void print_constants() { printf("ROW_SIZE: %d\n", Row::SIZE); diff --git a/src/compiler/parser.cpp b/src/compiler/parser.cpp index 8722a6f..9ee4770 100644 --- a/src/compiler/parser.cpp +++ b/src/compiler/parser.cpp @@ -1,4 +1,4 @@ -#include "modeldb/compiler/parser.hpp" +#include "eggshell/compiler/parser.hpp" #include #include diff --git a/src/compiler/statement.cpp b/src/compiler/statement.cpp index 7abae28..7373161 100644 --- a/src/compiler/statement.cpp +++ b/src/compiler/statement.cpp @@ -1,10 +1,10 @@ -#include "modeldb/compiler/statement.hpp" +#include "eggshell/compiler/statement.hpp" #include #include #include -#include "modeldb/storage/bplus/leafnode.hpp" +#include "eggshell/storage/bplus/leafnode.hpp" CmdPrepareResult Statement::prepare(std::string input) { if (input.starts_with("insert")) { diff --git a/src/repl.cpp b/src/repl.cpp index d0f092d..b704b90 100644 --- a/src/repl.cpp +++ b/src/repl.cpp @@ -1,8 +1,8 @@ #include #include -#include -#include -#include +#include +#include +#include #include void read_input(std::string& str) { @@ -28,7 +28,7 @@ int main(int argc, char* argv[]) { std::string input; while (true) { - std::cout << "modeldb > "; + std::cout << "eggshell > "; read_input(input); if (input[0] == '.') { switch (do_meta_cmd(input, table)) { diff --git a/src/storage/bplus/internalnode.cpp b/src/storage/bplus/internalnode.cpp index e7fbc5b..f246a3a 100644 --- a/src/storage/bplus/internalnode.cpp +++ b/src/storage/bplus/internalnode.cpp @@ -1,8 +1,8 @@ -#include "modeldb/storage/bplus/internalnode.hpp" +#include "eggshell/storage/bplus/internalnode.hpp" -#include "modeldb/storage/bplus/leafnode.hpp" -#include "modeldb/storage/bplus/node.hpp" -#include "modeldb/storage/cursor.hpp" +#include "eggshell/storage/bplus/leafnode.hpp" +#include "eggshell/storage/bplus/node.hpp" +#include "eggshell/storage/cursor.hpp" /* * Internal Node Header Layout diff --git a/src/storage/bplus/leafnode.cpp b/src/storage/bplus/leafnode.cpp index 18245cd..c75be52 100644 --- a/src/storage/bplus/leafnode.cpp +++ b/src/storage/bplus/leafnode.cpp @@ -1,7 +1,7 @@ -#include "modeldb/storage/bplus/leafnode.hpp" +#include "eggshell/storage/bplus/leafnode.hpp" -#include "modeldb/storage/bplus/internalnode.hpp" -#include "modeldb/storage/bplus/node.hpp" +#include "eggshell/storage/bplus/internalnode.hpp" +#include "eggshell/storage/bplus/node.hpp" const uint32_t LeafNode::LEAF_NODE_NUM_CELLS_SIZE = sizeof(uint32_t); const uint32_t LeafNode::LEAF_NODE_NUM_CELLS_OFFSET = diff --git a/src/storage/bplus/node.cpp b/src/storage/bplus/node.cpp index 41695d2..96a171e 100644 --- a/src/storage/bplus/node.cpp +++ b/src/storage/bplus/node.cpp @@ -1,7 +1,7 @@ -#include "modeldb/storage/bplus/node.hpp" +#include "eggshell/storage/bplus/node.hpp" -#include "modeldb/storage/bplus/internalnode.hpp" -#include "modeldb/storage/bplus/leafnode.hpp" +#include "eggshell/storage/bplus/internalnode.hpp" +#include "eggshell/storage/bplus/leafnode.hpp" const uint32_t Node::NODE_TYPE_SIZE = sizeof(uint8_t); const uint32_t Node::NODE_TYPE_OFFSET = 0; diff --git a/src/storage/cursor.cpp b/src/storage/cursor.cpp index 6f32cc4..f9548ef 100644 --- a/src/storage/cursor.cpp +++ b/src/storage/cursor.cpp @@ -1,6 +1,6 @@ -#include "modeldb/storage/cursor.hpp" +#include "eggshell/storage/cursor.hpp" -#include "modeldb/storage/bplus/leafnode.hpp" +#include "eggshell/storage/bplus/leafnode.hpp" Cursor::Cursor(Table& table, uint32_t page_num, uint32_t cell_num, bool end_of_table) diff --git a/src/storage/pager.cpp b/src/storage/pager.cpp index 7c817d2..6f558fa 100644 --- a/src/storage/pager.cpp +++ b/src/storage/pager.cpp @@ -1,4 +1,4 @@ -#include "modeldb/storage/pager.hpp" +#include "eggshell/storage/pager.hpp" Pager::Pager(std::string filename) : file{filename, file.in | file.out | file.binary} { diff --git a/src/storage/row.cpp b/src/storage/row.cpp index 405aff1..54c6752 100644 --- a/src/storage/row.cpp +++ b/src/storage/row.cpp @@ -1,4 +1,4 @@ -#include "modeldb/storage/row.hpp" +#include "eggshell/storage/row.hpp" #include diff --git a/src/storage/table.cpp b/src/storage/table.cpp index 3acd9b6..284b276 100644 --- a/src/storage/table.cpp +++ b/src/storage/table.cpp @@ -1,10 +1,10 @@ -#include "modeldb/storage/table.hpp" +#include "eggshell/storage/table.hpp" #include -#include "modeldb/storage/bplus/internalnode.hpp" -#include "modeldb/storage/bplus/leafnode.hpp" -#include "modeldb/storage/bplus/node.hpp" +#include "eggshell/storage/bplus/internalnode.hpp" +#include "eggshell/storage/bplus/leafnode.hpp" +#include "eggshell/storage/bplus/node.hpp" Table::Table(std::string filename) : pager{filename}, root_page_num{0} { if (pager.num_pages == 0) { diff --git a/tests/btree_test.cpp b/tests/btree_test.cpp index 7be4f5a..b34410c 100644 --- a/tests/btree_test.cpp +++ b/tests/btree_test.cpp @@ -1,3 +1,3 @@ #include -#include \ No newline at end of file +#include \ No newline at end of file