Skip to content

Commit

Permalink
Renamed repo to eggshell
Browse files Browse the repository at this point in the history
  • Loading branch information
rayzhuca committed Feb 19, 2024
1 parent 04699e7 commit dbd7073
Show file tree
Hide file tree
Showing 28 changed files with 62 additions and 62 deletions.
18 changes: 9 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
cmake_minimum_required(VERSION 3.22)
project("modeldb")
project("eggshell")

# setting version
set(CMAKE_CXX_STANDARD 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
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

add_executable(repl "src/repl.cpp")
target_link_libraries(repl PUBLIC modeldb)
target_link_libraries(repl PUBLIC eggshell)

# testing
enable_testing()
Expand All @@ -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)
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
#include <cstdint>
#include <string>

#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();

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

#include <string>

#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 };

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <cstdint>

#include "modeldb/storage/table.hpp"
#include "eggshell/storage/table.hpp"

namespace InternalNode {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#include <cstdint>

#include "modeldb/storage/cursor.hpp"
#include "modeldb/storage/row.hpp"
#include "eggshell/storage/cursor.hpp"
#include "eggshell/storage/row.hpp"

namespace LeafNode {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

#include <cstdint>

#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 {

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <mutex>
#include <string>

#include "modeldb/storage/table.hpp"
#include "eggshell/storage/table.hpp"

struct Table;

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#include <shared_mutex>
#include <string>

#include "modeldb/storage/cursor.hpp"
#include "modeldb/storage/pager.hpp"
#include "eggshell/storage/cursor.hpp"
#include "eggshell/storage/pager.hpp"

struct Cursor;

Expand Down
12 changes: 6 additions & 6 deletions src/compiler/metacmd/metacmd.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#include "modeldb/compiler/metacmd/metacmd.hpp"
#include "eggshell/compiler/metacmd/metacmd.hpp"

#include <iostream>

#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);
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/parser.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "modeldb/compiler/parser.hpp"
#include "eggshell/compiler/parser.hpp"

#include <iostream>
#include <string>
Expand Down
4 changes: 2 additions & 2 deletions src/compiler/statement.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include "modeldb/compiler/statement.hpp"
#include "eggshell/compiler/statement.hpp"

#include <cstring>
#include <shared_mutex>
#include <sstream>

#include "modeldb/storage/bplus/leafnode.hpp"
#include "eggshell/storage/bplus/leafnode.hpp"

CmdPrepareResult Statement::prepare(std::string input) {
if (input.starts_with("insert")) {
Expand Down
8 changes: 4 additions & 4 deletions src/repl.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <exception>
#include <iostream>
#include <modeldb/compiler/metacmd/metacmd.hpp>
#include <modeldb/compiler/statement.hpp>
#include <modeldb/storage/table.hpp>
#include <eggshell/compiler/metacmd/metacmd.hpp>
#include <eggshell/compiler/statement.hpp>
#include <eggshell/storage/table.hpp>
#include <string>

void read_input(std::string& str) {
Expand All @@ -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)) {
Expand Down
8 changes: 4 additions & 4 deletions src/storage/bplus/internalnode.cpp
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/storage/bplus/leafnode.cpp
Original file line number Diff line number Diff line change
@@ -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 =
Expand Down
6 changes: 3 additions & 3 deletions src/storage/bplus/node.cpp
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/storage/cursor.cpp
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/storage/pager.cpp
Original file line number Diff line number Diff line change
@@ -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} {
Expand Down
2 changes: 1 addition & 1 deletion src/storage/row.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "modeldb/storage/row.hpp"
#include "eggshell/storage/row.hpp"

#include <cstring>

Expand Down
8 changes: 4 additions & 4 deletions src/storage/table.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include "modeldb/storage/table.hpp"
#include "eggshell/storage/table.hpp"

#include <fstream>

#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) {
Expand Down
2 changes: 1 addition & 1 deletion tests/btree_test.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#include <gtest/gtest.h>

#include <modeldb/storage/table.hpp>
#include <eggshell/storage/table.hpp>

0 comments on commit dbd7073

Please sign in to comment.