Throughout this recursion and trees course, we have been building intuition about tree data structures, and you completed the last lesson with a fully implemented b-tree. Using this b-tree data structure, we showed how we could implement an index on a CSV file without having to alter our initial API too much. 

In this guided project, we will be using the b-tree data structure from before as the building block for a fully functioning, saving-to-disk, key-value store.

A key-value store is a database that operates similar to a Python dictionary but stored in a file. There are the important get and set methods that the dictionary contains, but the key-value store will also provide an API for saving to disk, loading from disk, range queries of our data, and others. Our goal will be to create an easy to use, flexible, and adaptable key value store that other developers could use in their projects.

These projects are meant to be challenging to better prepare you for the real world, so don't be discouraged if you have to refer back to previous missions. And as with all guided projects, we encourage you to experiment and extend your project after you’ve completed the guided instructions, taking it in unique directions to make it a more compelling addition to your portfolio!

Objectives

  • Adapt a well-known data structure to create a database.
  • Learn about a hey-value database and how it is implemented.

Lesson Outline

1. Motivation for a Key-Value Store
2. Implement the Get and Set
3. Override the Initializer
4. Reimplementing the Range Queries
5. Dump and Load the KV Store
6. Load from Dictionary
7. Next Steps