mafintosh/level-dat — pull request #1 by ekg (2014-10-17 19:22:26+00:00)
Title: change log ids in data keys and current table

This is the backend commit enabling https://github.com/maxogden/dat/pull/207.

This pull request adds reference to the change log id to the keys in the data table (`PREFIX_DATA+subset+SEP+key+SEP+version+SEP+change = data`) and stores the change alongside the version in the current table (`PREFIX_CUR+subset+SEP+key = version+SEP+change`).

By doing this, it becomes possible to compare any two versions of objects by order of creation. A linear scan of the data is sufficient to set the current state of the db back to a particular point in the log. If we did not store this information, we would need to roll the entire log back. Additionally, it would be difficult to efficiently complete this operation for a subset of the db.