Class KeyLookup
KeyStoreWriter.
Care has been taken to make this structure as efficient as possible. Reading keys does not require allocating data heap buffers per each read operation. Only one key at a time is loaded to memory. Low complexity algorithms are used – a lookup of the key by point id is constant time, and a lookup of the point id by the key is logarithmic.
Because the blocks are prefix compressed, random access applies only to the locating the whole block. In order to jump to a concrete key inside the block, the block keys are iterated from the block beginning.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassAllows reading the keys from the keys file. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionKeyLookup(FileHandle keysFileHandle, FileHandle keysBlockOffsets, KeyLookupMeta keyLookupMeta, NumericValuesMeta keyBlockOffsetsMeta) Creates a new reader based on its data components. -
Method Summary
Modifier and TypeMethodDescriptionOpens a cursor over the keys stored in the keys file.
-
Field Details
-
INDEX_OUT_OF_BOUNDS
- See Also:
-
-
Constructor Details
-
KeyLookup
public KeyLookup(@Nonnull FileHandle keysFileHandle, @Nonnull FileHandle keysBlockOffsets, @Nonnull KeyLookupMeta keyLookupMeta, @Nonnull NumericValuesMeta keyBlockOffsetsMeta) throws IOException Creates a new reader based on its data components.It does not own the components, so you must close them separately after you're done with the reader.
- Parameters:
keysFileHandle- handle to the file with a sequence of prefix-compressed blocks each storing a fixed number of keyskeysBlockOffsets- handle to the file containing an encoded sequence of the file offsets pointing to the blockskeyLookupMeta- metadata object created earlier by the writerkeyBlockOffsetsMeta- metadata object for the block offsets- Throws:
IOException
-
-
Method Details
-
openCursor
Opens a cursor over the keys stored in the keys file.This will read the first key into the key buffer and point to the first point in the keys file.
The cursor is to be used in a single thread. The cursor is valid as long this object hasn't been closed. You must close the cursor when you no longer need it.
- Throws:
IOException
-