Skip to content

Latest commit

 

History

History
127 lines (91 loc) · 2.67 KB

README.md

File metadata and controls

127 lines (91 loc) · 2.67 KB

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

make

This creates the executable in the build directory

You'll then be presented with the following prompt

> 

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

> GET KEY

WRITE

> 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.

> SET full-name John Smith II

UPDATE

> PUT KEY VALUE

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

DELETE

> 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

> BEGIN

END: Ends the current active transaction

> END

ROLLBACK: Discards the changes made by current transaction

> ROLLBACK

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

> ROLLBACK

Other Operations 🧪

CLEAR

To clear the 'shell'
> CLEAR

EXIT

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

PRINT

To Print the current active transaction's store
> PRINT

Additional Notes 🎉

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

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

	return 0;
}