K
- The type of the key.N
- The type of the namespace.UK
- The type of the keys in the state.UV
- The type of the values in the state.public class HeapMapState<K,N,UK,UV> extends AbstractHeapState<K,N,HashMap<UK,UV>,MapState<UK,UV>,MapStateDescriptor<UK,UV>> implements InternalMapState<N,UK,UV>
MapState
that is snapshotted into files.currentNamespace, keySerializer, namespaceSerializer, stateDesc, stateTable
Constructor and Description |
---|
HeapMapState(MapStateDescriptor<UK,UV> stateDesc,
StateTable<K,N,HashMap<UK,UV>> stateTable,
TypeSerializer<K> keySerializer,
TypeSerializer<N> namespaceSerializer)
Creates a new key/value state for the given hash map of key/value pairs.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(UK userKey)
Returns whether there exists the given mapping.
|
Iterable<Map.Entry<UK,UV>> |
entries()
Returns all the mappings in the state
|
UV |
get(UK userKey)
Returns the current value associated with the given key.
|
byte[] |
getSerializedValue(K key,
N namespace) |
Iterator<Map.Entry<UK,UV>> |
iterator()
Iterates over all the mappings in the state.
|
Iterable<UK> |
keys()
Returns all the keys in the state
|
void |
put(UK userKey,
UV userValue)
Associates a new value with the given key.
|
void |
putAll(Map<UK,UV> value)
Copies all of the mappings from the given map into the state.
|
void |
remove(UK userKey)
Deletes the mapping of the given key.
|
Iterable<UV> |
values()
Returns all the values in the state.
|
clear, getSerializedValue, getStateTable, setCurrentNamespace
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSerializedValue, setCurrentNamespace
public HeapMapState(MapStateDescriptor<UK,UV> stateDesc, StateTable<K,N,HashMap<UK,UV>> stateTable, TypeSerializer<K> keySerializer, TypeSerializer<N> namespaceSerializer)
stateDesc
- The state identifier for the state. This contains name
and can create a default state value.stateTable
- The state tab;e to use in this kev/value state. May contain initial state.public UV get(UK userKey)
MapState
public void put(UK userKey, UV userValue)
MapState
public void putAll(Map<UK,UV> value)
MapState
public void remove(UK userKey)
MapState
public boolean contains(UK userKey)
MapState
public Iterable<Map.Entry<UK,UV>> entries()
MapState
public Iterable<UK> keys()
MapState
public Iterable<UV> values()
MapState
public Iterator<Map.Entry<UK,UV>> iterator()
MapState
public byte[] getSerializedValue(K key, N namespace) throws IOException
getSerializedValue
in class AbstractHeapState<K,N,HashMap<UK,UV>,MapState<UK,UV>,MapStateDescriptor<UK,UV>>
IOException
Copyright © 2014–2018 The Apache Software Foundation. All rights reserved.