| Trees | Indices | Help |
|
|---|
|
|
object --+
|
DiskIndex --+
|
OceanIndex
This is the main implementation of OceanIndex new in version 2. The implementation details are described in detail in the docstring for diskindex.
| Instance Methods | |||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Inherited from Inherited from |
|||
| Class Variables | |
HEADER = Struct("!2sI")(MAGIC, VERSION) |
|
FANOUT = Struct("!Q")(no of items < n[0]) |
|
ITEM = Struct("!dQL")(time, offset, length) |
|
VERSION = 2
|
|
| Properties | |
|
Inherited from |
| Method Details |
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
|
This method doesn't work correctly. It uses the size of the cache + the total size from the fanout. Items read from disk which are in the cache will be double counted.
|
Checks if key is in the index. Since we'll have to seek there anyways, this method, also reads the item and populates the index.
|
Reads the key from disk and returns the item. This method takes 2 seeks. The first seek reads the level-1 fanout tablespace = (total size/128) * 16 bytes and searches it. This information is used to directly seek to the correct location in the itemspace. It reads ITEM.size bytes (20 bytes for Ocean, 36 bytes for Sea as of version 2). The itemspace is kept separate from keyspace to reduce the memory cost of reading the tablespace and speed up the find operations (since there is lesser data).
|
Read and validate the file header. Also does version checking. |
Commit the diskindex. This method is thread-safe. It is designed to be run asynchronously. It uses some pretty advanced trickery with generators to reduce the distance between seeks and is also quite memory efficient. Also, all the data is written to a .il file and then atomically renamed. This is also why the read-file-pointer needs to be re-opened at the beginning of every transaction.
|
Commits and closes the diskindex.
|
This method reads the whole index file (possibly very very large) and sequentially validates that each dirty entry as been written. This method is designed for debugging and is NOT to be used in production. Call this method inside the commit method (before resetting _dirty) to validate that the commit is ok. |
| Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Fri Jun 27 12:35:57 2008 | http://epydoc.sourceforge.net |