public class MphMap<K,V>
extends java.lang.Object
implements java.util.Map<K,V>, java.io.Serializable
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
boolean |
containsKey(java.lang.Object o) |
boolean |
containsValue(java.lang.Object o) |
static <K,V> MphMap<K,V> |
deserialize(java.io.InputStream in)
Static constructor to deserialize an MphMap.
|
java.util.Set<java.util.Map.Entry<K,V>> |
entrySet() |
static <K,V> MphMap<K,V> |
fromKeyValues(TableConfig<K,V> config,
java.lang.Iterable<com.indeed.util.core.Pair<K,V>> entries)
Static constructor to build a table from key/value pairs, as
would be passed to the
TableWriter constructor. |
static <K,V> MphMap<K,V> |
fromMap(TableConfig<K,V> config,
java.util.Map<K,V> entries)
Static constructor to build a table from another Map.
|
V |
get(java.lang.Object o) |
TableConfig<K,V> |
getConfig()
Returns the config for this mph table, specifying serializers and other info.
|
V |
getForHash(long hash) |
long |
getHash(K key) |
long |
getHashOffset(long hash) |
K |
getKeyForHash(long hash) |
com.indeed.util.mmap.MemoryDataInput |
getMemoryForHash(long hash) |
long |
getOffset(K key) |
long |
getSizeInBytes() |
long |
getTimestamp() |
boolean |
isEmpty() |
java.util.Set<K> |
keySet() |
static <K,V> MphMap<K,V> |
load(java.io.File metaPath) |
static <K,V> MphMap<K,V> |
load(java.io.File metaPath,
java.io.File offsetsPath,
java.io.File dataPath)
Static constructor to load a disk-based mph table (as created
by
TableWriter) into memory. |
V |
put(K key,
V value) |
void |
putAll(java.util.Map<? extends K,? extends V> m) |
V |
remove(java.lang.Object key) |
int |
size() |
java.util.Collection<V> |
values() |
public static <K,V> MphMap<K,V> load(@Nonnull java.io.File metaPath, @Nullable java.io.File offsetsPath, @Nullable java.io.File dataPath) throws java.io.IOException
TableWriter) into memory.K - key typeV - value typemetaPath - path to the table's meta-data, either the exact file or the containing directoryoffsetsPath - path to the raw offsets if different from the meta-data settingdataPath - path to the raw serialized data if different from the meta-data settingjava.io.IOException - if unable to open any of the files, or deserialize the metadatapublic static <K,V> MphMap<K,V> load(@Nonnull java.io.File metaPath) throws java.io.IOException
java.io.IOExceptionpublic static <K,V> MphMap<K,V> deserialize(@Nonnull java.io.InputStream in) throws java.io.IOException
K - key typeV - value typein - an input stream to read the serialized object fromjava.io.IOException - if unable to deserializepublic static <K,V> MphMap<K,V> fromMap(@Nonnull TableConfig<K,V> config, @Nonnull java.util.Map<K,V> entries) throws java.io.IOException
K - key typeV - value typeconfig - the TableConfig specifying at least the key/value serializersentries - the Map to copy fromjava.io.IOException - if unable to serializepublic static <K,V> MphMap<K,V> fromKeyValues(@Nonnull TableConfig<K,V> config, @Nonnull java.lang.Iterable<com.indeed.util.core.Pair<K,V>> entries) throws java.io.IOException
TableWriter constructor.K - key typeV - value typeconfig - the TableConfig specifying at least the key/value serializersentries - an iterable of key/value pairs to covnert to a Mapjava.io.IOException - if unable to serializepublic TableConfig<K,V> getConfig()
public boolean containsKey(@Nonnull
java.lang.Object o)
public boolean containsValue(java.lang.Object o)
public com.indeed.util.mmap.MemoryDataInput getMemoryForHash(long hash)
throws java.io.IOException
java.io.IOExceptionpublic K getKeyForHash(long hash) throws java.io.IOException
java.io.IOExceptionpublic V getForHash(long hash) throws java.io.IOException
java.io.IOExceptionpublic long getHash(@Nonnull
K key)
public long getOffset(@Nonnull
K key)
public long getHashOffset(long hash)
public long getSizeInBytes()
public long getTimestamp()
Copyright © 2018. All Rights Reserved.