An open API service indexing awesome lists of open source software.

https://github.com/kylesmith19091/keyvaluestore

Implementation of a Key Value Store Protocol for NoSQL
https://github.com/kylesmith19091/keyvaluestore

cpp11 key-value nosql tui

Last synced: 12 months ago
JSON representation

Implementation of a Key Value Store Protocol for NoSQL

Awesome Lists containing this project

README

          


Transactional Key Value Store Implmentation



This is an in progress implmentation of a transactional Key-Value store implementation from scratch. Currently we only use few standard library functions such as strings, io and unordered maps as the stores. This is purely educational, where I wanted to implement as much of the functionality from scratch, such as creating my own Stack and in the future a hashmap implementation.

---
## Installation ⚡️

* Building from sratch

This requires a g++ compiler, that is also able to compile c++ 11
```bash
make
```


This creates the executable in the build directory

You'll then be presented with the following prompt
```bash
>
```

This 'mini-shell' environment will serve as your interface into the key-value store

## CRUD Operations ⭐️
** Note, keys are case sensitive, but the operations are not.

READ

```bash
> GET KEY
```

WRITE

```bash
> SET KEY VALUE
```

** In this case the value can be anything, the interpreter will assume that all input after the given KEY is the value. This does include space seperated data.

For Ex.

```bash
> SET full-name John Smith II
```

UPDATE

```bash
> PUT KEY VALUE
```

** SET can also be used as a PUT, it will overwrite the key's value

DELETE

```bash
> DELETE KEY
```

## Transactional Operations 🚦
Since this is a transactional key-value store implementation, we need the ability to create, end, rollback and commit transactions. Transactions are handled using a Stack, where the
top of the stack represents the active transaction.

BEGIN: Starts a new transaction

```bash
> BEGIN
```

END: Ends the current active transaction

```bash
> END
```

ROLLBACK: Discards the changes made by current transaction

```bash
> ROLLBACK
```

COMMIT: Commits the changes made by active transaction to global store

```bash
> ROLLBACK
```

## Other Operations 🧪

CLEAR


To clear the 'shell'

```bash
> CLEAR
```

EXIT


To gracefully exit the shell, CTRL+C or your equivalent will also work

```bash
> EXIT
```

PRINT


To Print the current active transaction's store

```bash
> PRINT
```

## Additional Notes 🎉
You can customise the prompt token, by changing the constructor value in the Main.cpp file

```c++
int main() {
// Interface into key-value store
Shell s("❯");
s.init();

return 0;
}
```