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.
- Java: A Java Development Kit (JDK), version 17 or later, is required to build and run the server.
- Python: Python 3 and
pipare needed to run the integration tests.
# 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
pytestThe 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:
OKon success. ReturnsRESERVED KEYWORD __TOMBSTONE__if the value is__TOMBSTONE__. ReturnsINVALID INPUTif the format is incorrect.
- Usage:
-
GET: Retrieves the value associated with a given key.
- Usage:
GET <key> - Example:
GET mykey - Response: The value associated with the key, or
NOT FOUNDif the key does not exist. ReturnsINVALID INPUTif the format is incorrect.
- Usage:
-
DELETE: Marks a key for deletion (writes a tombstone record).
- Usage:
DELETE <key> - Example:
DELETE mykey - Response:
OKon success, orNOT FOUNDif the key does not exist. ReturnsINVALID INPUTif the format is incorrect.
- Usage:
-
EXISTS: Checks if a key exists in the store (and is not deleted).
- Usage:
EXISTS <key> - Example:
EXISTS mykey - Response:
trueif the key exists,falseotherwise. ReturnsINVALID INPUTif the format is incorrect.
- Usage:
-
FLUSH: Deletes all the keys in the store.
- Usage:
FLUSH - Response:
OKon success.
- Usage:
-
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.
- Usage:
