about
12/02/2022
NoSqlDb Repo
CppNoSqlDb Repository
Demonstration prototype for No SQL database
Quick Status
1.0 Concept
2.0 Design
- DbCore<P> package: provides an in-memory key-value database, based on the C++ std::unordered_map<key, value>. It provides only in-memory storage, leaving other database operations, like querys and pesistance to other packages.
- DbElement<P> package: represents a single record in the database. It contains metadata items name, time-date, and children. Children provide a way to easily establish relationships between records, perhaps based on dependencies. The template parameter P (Payload) represents the data we want to store, and the metadata simply provides information about each of the P values.
- Query<P> package: supports extracting information from the database. Queries start with a key set, looking for values and or keys that satisfy some condition, and returns a new key set with all the keys for records that match. Note that this design supports making compound queries where each subquery operates on the key set returned by its predecessor subquery, resulting in a progressive narrowing of the returned keys. You might think of this Query process as returning a new, probably smaller database, e.g., set of keys and values.
- Persist<P> package: provides durable storage for the database or some shard of the database. Persist simply makes a query, usually returning the entire database, and saves that to a file. In this design we use XML storage, but JSON data or some other data format would work as well, and it is easy to configure the database for alternate storage formats by using a different Persist package. Note that it is, with this design, easy to shard partial contents of the database to a shard file. The only thing required to shard is to make a query that returns less than the entire database.