mafintosh / hyperdb

Distributed scalable database
MIT License
753 stars 75 forks source link

question: get an earlier version of a key #68

Closed utanapishtim closed 6 years ago

utanapishtim commented 6 years ago

Is there a way to read an earlier version of a key without checking out an earlier version of the database? If you can point me to the relevant sections of the code I can try to read a bit more.

I spent most of last night in lib/get and the Writer prototype in index.js, couldn't figure it out...

Thanks!

hackergrrl commented 6 years ago

Hey @utanapishtim. There's not a clear API really yet for getting a node by a specific version. You can do it right now by using hyperdb#version to get a time snapshot after you write a node, and then use hyperdb#checkout to get that old db state and do a hyperdb#get on that key.

Check out https://github.com/mafintosh/hyperdb/issues/15

utanapishtim commented 6 years ago

Ok, thanks!