Package org.nustaq.offheap
Class FSTAsciiStringOffheapMap<V>
Created by ruedi on 27.06.14.
An offheap hashmap. Keys are strings with a given max length. The longer the strings, the slower
lookup will be. Values < 50 are ok'ish.
The Map can reside on disk (using mmapped files) or just in offheap.
Note that changing stored classes will lead to decoding errors in case of persisted files.
You need to make use of FST versioning annotation in order to avoid this.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.nustaq.offheap.FSTBinaryOffheapMap
FSTBinaryOffheapMap.KeyValIter -
Field Summary
Fields inherited from class org.nustaq.offheap.FSTSerializedOffheapMap
buffer, coder, tmpValFields inherited from class org.nustaq.offheap.FSTBinaryOffheapMap
alloc, bytezOffset, CORE_HEADER_LEN, CUSTOM_FILEHEADER_LEN, customHeader, FILE_HEADER_LEN, freeList, GB, index, KEY_OFFSET_IN_HEADER, keyLen, mappedFile, MB, memory, mutationCount, numElem -
Constructor Summary
ConstructorsConstructorDescriptionFSTAsciiStringOffheapMap(int keyLen, long sizeMemBytes, int numberOfEleems) FSTAsciiStringOffheapMap(int keyLen, long sizeMemBytes, int numberOfEleems, FSTCoder coder) see other mem constructor, additional allows to insert a coder.FSTAsciiStringOffheapMap(String file, int keylen, long size, int numelem) create a memory mapped offheap hashmapFSTAsciiStringOffheapMap(String mappedFile, int keyLen, long sizeMemBytes, int numberOfElems, FSTCoder coder) see other mem mapped file constructor + additional allows to insert a coder. -
Method Summary
Methods inherited from class org.nustaq.offheap.FSTSerializedOffheapMap
decodeValue, encodeValue, getCoder, getEntryLengthForContentLengthMethods inherited from class org.nustaq.offheap.FSTCodedOffheapMap
get, put, remove, valuesMethods inherited from class org.nustaq.offheap.FSTBinaryOffheapMap
addEntry, addToFreeList, binaryKeys, binaryValues, decElems, dumpIndexStats, finalize, free, getBinary, getCapacityMB, getContentLenFromHeader, getCustomFileHeader, getFileName, getFreeMem, getHeaderLen, getLenFromHeader, getSize, getUsedMem, incElems, init, initFromFile, main, printBinaryKey, putBinary, removeBinary, removeEntry, resizeStore, setEntry, writeEntryHeader
-
Constructor Details
-
FSTAsciiStringOffheapMap
see other mem constructor, additional allows to insert a coder. Useful to preregister classes (speed+size gain, no classnames written!). E.g. new DefaultCoder(MyValue.class, MyOtherValue.class, .. ) -
FSTAsciiStringOffheapMap
public FSTAsciiStringOffheapMap(int keyLen, long sizeMemBytes, int numberOfEleems) - Parameters:
keyLen- - maximum len of a keysizeMemBytes- - size of memory (not bigger than OS heapnumberOfEleems- - estimation on number of key-value pairs (autogrow, just educated guess)
-
FSTAsciiStringOffheapMap
public FSTAsciiStringOffheapMap(String mappedFile, int keyLen, long sizeMemBytes, int numberOfElems, FSTCoder coder) throws Exception see other mem mapped file constructor + additional allows to insert a coder. Useful to preregister classes (speed+size gain, no classnames written!). E.g. new DefaultCoder(MyValue.class, MyOtherValue.class, .. )- Throws:
Exception
-
FSTAsciiStringOffheapMap
create a memory mapped offheap hashmap- Parameters:
file- - the file location. If file exists, it will be loaded Attention: in case classes changed you need to delete files as objects won't be compatible (except you made use of fst versioning features)keylen- - the maximum len of a keysize- - max size of file (can be GB, check OS settings to avoid eager write-to-disk)numelem- - estimated number of key-value pairs (will auto-grow, just educated guess)- Throws:
Exception
-
-
Method Details
-
encodeKey
- Specified by:
encodeKeyin classFSTCodedOffheapMap<String,V>
-