Skip to content

theokiwi/simpledb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SimpleDB

A high-performance, in-memory, key-value NoSQL database, inspired by Redis and written in C++.

Language License GitHub Stars


📖 Table of Contents

📍 About the Project

SimpleDB is an implementation of a key-value database that operates entirely in memory, aiming for simplicity and speed. Inspired by the architecture and commands of Redis, this project was developed as a practical study of data structures, network programming (sockets), and multithreading in C++.

The server listens for TCP connections and interprets simple text commands to manipulate data, making it a lightweight and easy-to-interact-with tool.

✨ Key Features

  • CRUD Operations: Support for essential GET, SET, and DELETE commands.
  • Additional Commands: Includes EXISTS to check for a key's existence and KEYS to list all keys.
  • Multithreading: The server is capable of handling multiple clients simultaneously by dedicating a thread to each connection.
  • TCP/IP Communication: Interaction with the database occurs through a socket server, using clients like netcat or telnet.
  • Simplified Build: Uses a Makefile to automate the compilation process.

🛠️ Tech Stack

  • C++: The main language of the project (using C++17 features).
  • Makefile: For build automation.
  • Sockets API (POSIX): For TCP network communication.

🚀 Getting Started

Prerequisites

To compile and run the project, you will need:

  • A C++ compiler (like g++)
  • make

Installation & Execution

  1. Clone the repository:
    git clone [https://github.com/theokiwi/simpledb.git](https://github.com/theokiwi/simpledb.git)
    cd simpledb
  2. Compile the project: The Makefile will handle the compilation of both the server (db_main) and the client (client_main).
    make
  3. Run the DB Server: In a terminal window, start the database server. It will listen for connections.
    ./db_main

👨‍💻 Usage

In a separate terminal, use the client_main executable to interact with the database server.

  • To start the DB:
    ./db_main
  • To insert into the DB:
    ./client_main simpledb insert key value
  • To remove from the DB:
    ./client_main simpledb remove value
  • To update the DB:
    ./client_main simpledb update oldValue newValue
  • To search the DB:
    ./client_main simpledb search value
  • To stop the DB server:
    ./client_main simpledb quit
  • To exit the client:
    ./client_main quit

📧 Contact

Theo - GitHub

About

A simple non sql database for the course "Sistemas Operacionais" on PUC Minas. Built on C++.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages