This is an improved version of the basic_log, supporting some functionality common to SSTables, namely the creation, merging and compaction of segments. The interface is as follows:
- store {key} {data} : store the pair (key, value) in the database
- get {key} : retrieve the most recent value on disk associated with key
- compact_segments : run the compact and merge algorithm on the segments on disk.
- load_index : scan the current segment, and load its values into the index. this requires a linear parse of the file and is slow!
- save_index_snapshot {filename} : save a snapshot of the index to disk, as a pickle dump named {filename}
- load_index_snapshot {filename} : load an aforementioned snapshot on the index to disks
- set_threshold {number of bytes} : set the new segment threshold for the db in bytes
The main improvement over the basic_log comes in the use of an index to perform fast lookups on key values pairs, and the introduction of segments and the compaction algorithm to reclaim diskspace and speed up reads.
The project requires python3.
Invoke python main.py
.
Invoke python augemented_log_tests.py
.
Invoke python augmented_log.py