I want to implement a key-value store (as Redis) in C#, play with data structures, and practice TDD (Test-Driven Development). I started:
The current structure:
There is a class library project, AjKeyvs, that contains the collections in an in-memory repository. The interesting part of this projects is to implement arrays and sets that can be sparse, having different keys. Example, having a key 1 (one) and a key 1000000 (one million) does not imply to have an array with one million positions. At the same, I want to have a good access and update time. In other use cases, I will have string keys, like “user”, “user:1”, “user:1:email”, etc. There are use cases that need the use of sets, with union, intersection, difference, etc… For integer keys, I jave a set where a could turn a bit on or off, for the presence or absense of an element. More implementation details in upcoming post.
The library can be used in-process, but I added a server and a client program. The server listen commands sent by the clientes. All collections reside in memory. Persistence is something orthogonal to the implemented use cases. I should decide if add the persistence into the command processing, or is something to be implemented outside the project.
As usual, I followed TDD workflow.
Next topics: data structures, collections, commands, concurrency, etc.