GooseDB
A full database system I'm building from the ground up in C++23, for storing and querying media.
GooseDB is meant to work more like a distributed, S3-style store than a classic single-machine database: data spread and replicated across machines, with a query layer on top.
I'm building it from the ground up as I work through Carnegie Mellon's database course, starting with the storage engine: 4 KB pages that hold tuples, each with a header, and table schemas that describe their columns.
Clients
Store and query media
Query layer
Parse, plan, execute
Storage engine
4 KB pages of tuples, schemas
Many machines
Spread and replicate data
- Clients and Query layer
- Query layer and Storage engine
- Storage engine and Many machines
See it work
Where it stands: a page, from include/storage/page.hpp
static constexpr std::size_t PAGE_SIZE = 4096;
class Page {
public:
Page(Header header) : header(header) {}
void add_tuple(const std::vector<std::byte>& d) {
std::size_t free_offset = header.get_free_space_offset();
std::size_t tuple_count = header.get_tuple_count();
header.set_tuple_count(tuple_count + 1);
std::copy(d.begin(), d.end(), data.begin() + free_offset);
}
private:
Header header;
std::vector<std::byte> data = std::vector<std::byte>(PAGE_SIZE);
};Every page is 4 KB. Adding a tuple bumps the count in the page's header and copies the bytes in at the free-space offset.