peterbourgon / diskv

A disk-backed key-value store.
http://godoc.org/github.com/peterbourgon/diskv
MIT License
1.41k stars 102 forks source link

diskv: add a KeysPrefix() #11

Closed philips closed 9 years ago

philips commented 9 years ago

In rocket we are looking at using sha512. The problem is that sha512 hashes are quite large. So, we will give users the option to truncate the hashes to 256 bits instead. Which means we have to find the matching key by prefix.

To that end It would be great if we could add a Prefix iterator to diskv so if I am given a hash that is shorter than 512bits I at least only have to iterate through keys that have matching directory prefixes.

Thoughts?

peterbourgon commented 9 years ago

I think I understand. Should be straightforward.

philips commented 9 years ago

@peterbourgon Yea, it will essentially take the TransformFunction and then only return keys found deeper than the prefix.

philips commented 9 years ago

Closing this out since #12 fully adds this issue.