This module defines writer and reader classes for a fast, immutable on-disk key-value database format. The current format is based heavily on D. J. Bernstein’s CDB format (http://cr.yp.to/cdb.html).
Implements a fast on-disk key-value store. This hash uses a two-level hashing scheme, where a key is hashed, the low eight bits of the hash value are used to index into one of 256 hash tables. This is basically the CDB algorithm, but unlike CDB this object writes all data serially (it doesn’t seek backwards to overwrite information at the end).
Also unlike CDB, this format uses 64-bit file pointers, so the file length is essentially unlimited. However, each key and value must be less than 2 GB in length.
Parameters: |
|
---|
Adds a key/value pair to the file. Note that keys DO NOT need to be unique. You can store multiple values under the same key and retrieve them using HashReader.all().
Convenience method to add a sequence of (key, value) pairs. This is the same as calling HashWriter.add() on each pair in the sequence.
Reader for the fast on-disk key-value files created by HashWriter.
Parameters: |
|
---|
Yields a sequence of values associated with the given key.
Convenience method to open a hash file given a whoosh.filedb.filestore.Storage object and a name. This takes care of opening the file and passing its length to the initializer.
Yields a sequence of (datapos, datalength) tuples associated with the given key.
Implements an on-disk hash, but requires that keys be added in order. An OrderedHashReader can then look up “nearest keys” based on the ordering.
Parameters: |
|
---|