Skip to content

mrdlm/MangoDB

Repository files navigation

MangoDB

MangoDB Logo

MangoDB is a durable, high-speed key-value store built in Java 17. Originally inspired by Riak's BitCask storage engine, it uses an append-only log structure for high write throughput. While BitCask is single-threaded, MangoDB utilises all the underlying cores of a machine for maximal performance.

Getting Started

Prerequisites

  • Java: A Java Development Kit (JDK), version 17 or later, is required to build and run the server.
  • Python: Python 3 and pip are needed to run the integration tests.

Building the Project

# Make the script executable (only needed once)
chmod +x run.sh

# Build and run the server
./run.sh

# Run the integration tests
pip install -r requirements.txt
pytest

Operations

The key-value store supports the following operations. Commands are case-insensitive.

  • PUT: Stores a key-value pair.

    • Usage: PUT <key> <value>
    • Example: PUT mykey myvalue
    • Response: OK on success. Returns RESERVED KEYWORD __TOMBSTONE__ if the value is __TOMBSTONE__. Returns INVALID INPUT if the format is incorrect.
  • GET: Retrieves the value associated with a given key.

    • Usage: GET <key>
    • Example: GET mykey
    • Response: The value associated with the key, or NOT FOUND if the key does not exist. Returns INVALID INPUT if the format is incorrect.
  • DELETE: Marks a key for deletion (writes a tombstone record).

    • Usage: DELETE <key>
    • Example: DELETE mykey
    • Response: OK on success, or NOT FOUND if the key does not exist. Returns INVALID INPUT if the format is incorrect.
  • EXISTS: Checks if a key exists in the store (and is not deleted).

    • Usage: EXISTS <key>
    • Example: EXISTS mykey
    • Response: true if the key exists, false otherwise. Returns INVALID INPUT if the format is incorrect.
  • FLUSH: Deletes all the keys in the store.

    • Usage: FLUSH
    • Response: OK on success.
  • STATUS: Retrieves statistics about the storage engine.

    • Usage: STATUS
    • Response: A multi-line string containing Disk Size, Data File Counts, Key Directory Size, and Time Since Start-up.

About

MangoDB is a blazingly-fast, distributed key-value store written in Java

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published