Class FSTCodedOffheapMap<K,V>

java.lang.Object
org.nustaq.offheap.FSTBinaryOffheapMap
org.nustaq.offheap.FSTCodedOffheapMap<K,V>
Direct Known Subclasses:
FSTSerializedOffheapMap

public abstract class FSTCodedOffheapMap<K,V> extends FSTBinaryOffheapMap
An offheap map adding mechanics to encode and decode keys and values. Again remember keys have to be of fixed size and should be as short as possible. Performance and memory consumtpion is best if significant digits are at the end of a key (e.g. "year_montH_day" instead "day_month_year". This class can be used for manual implementation of encoding/decoding. See StringOffHeapMap for an example on how to do efficient wrapping/encoding of keys
  • Constructor Details

    • FSTCodedOffheapMap

      public FSTCodedOffheapMap(int keyLen, long sizeMemBytes, int numberOfElems)
    • FSTCodedOffheapMap

      public FSTCodedOffheapMap(String mappedFile, int keyLen, long sizeMemBytes, int numberOfElems) throws Exception
      Throws:
      Exception
  • Method Details

    • encodeKey

      public abstract ByteSource encodeKey(K key)
    • encodeValue

      public abstract ByteSource encodeValue(V value)
    • decodeValue

      public abstract V decodeValue(BytezByteSource val)
    • get

      public V get(K key)
    • put

      public void put(K key, V value)
    • remove

      public void remove(K key)
    • values

      public Iterator<V> values()
      Warning: Concurrent Modification (e.g. add remove elements during iteration) is NOT SUPPORTED and NOT CHECKED. Collect keys to change inside an iteration and perform changes on the map after iteration is finished.
      Returns:
      an iterator on the values contained in this map.