K
- The key type of the elements in the Broadcast State
.V
- The value type of the elements in the Broadcast State
.public class HeapBroadcastState<K,V> extends Object implements BackendWritableBroadcastState<K,V>
Broadcast State
backed a heap-based Map
.Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes the value mapped under the current key.
|
boolean |
contains(K key)
Returns whether there exists the given mapping.
|
HeapBroadcastState<K,V> |
deepCopy() |
Iterable<Map.Entry<K,V>> |
entries()
Returns all the mappings in the state.
|
V |
get(K key)
Returns the current value associated with the given key.
|
MapSerializer<K,V> |
getInternalMapCopySerializer() |
RegisteredBroadcastStateBackendMetaInfo<K,V> |
getStateMetaInfo() |
Iterable<Map.Entry<K,V>> |
immutableEntries()
Returns an immutable
Iterable over the entries in the state. |
Iterator<Map.Entry<K,V>> |
iterator()
Iterates over all the mappings in the state.
|
void |
put(K key,
V value)
Associates a new value with the given key.
|
void |
putAll(Map<K,V> map)
Copies all of the mappings from the given map into the state.
|
void |
remove(K key)
Deletes the mapping of the given key.
|
void |
setStateMetaInfo(RegisteredBroadcastStateBackendMetaInfo<K,V> stateMetaInfo) |
String |
toString() |
long |
write(FSDataOutputStream out) |
public void setStateMetaInfo(RegisteredBroadcastStateBackendMetaInfo<K,V> stateMetaInfo)
setStateMetaInfo
in interface BackendWritableBroadcastState<K,V>
public RegisteredBroadcastStateBackendMetaInfo<K,V> getStateMetaInfo()
getStateMetaInfo
in interface BackendWritableBroadcastState<K,V>
public HeapBroadcastState<K,V> deepCopy()
deepCopy
in interface BackendWritableBroadcastState<K,V>
public void clear()
State
public long write(FSDataOutputStream out) throws IOException
write
in interface BackendWritableBroadcastState<K,V>
IOException
public V get(K key)
ReadOnlyBroadcastState
The user code must not modify the value returned, as this can lead to inconsistent states.
get
in interface ReadOnlyBroadcastState<K,V>
key
- The key of the mappingpublic void put(K key, V value)
BroadcastState
put
in interface BroadcastState<K,V>
key
- The key of the mappingvalue
- The new value of the mappingpublic void putAll(Map<K,V> map)
BroadcastState
putAll
in interface BroadcastState<K,V>
map
- The mappings to be stored in this statepublic void remove(K key)
BroadcastState
remove
in interface BroadcastState<K,V>
key
- The key of the mappingpublic boolean contains(K key)
ReadOnlyBroadcastState
contains
in interface ReadOnlyBroadcastState<K,V>
key
- The key of the mappingpublic Iterator<Map.Entry<K,V>> iterator()
BroadcastState
iterator
in interface BroadcastState<K,V>
public Iterable<Map.Entry<K,V>> entries()
BroadcastState
entries
in interface BroadcastState<K,V>
public Iterable<Map.Entry<K,V>> immutableEntries()
ReadOnlyBroadcastState
Iterable
over the entries in the state.
The user code must not modify the entries of the returned immutable iterator, as this can lead to inconsistent states.
immutableEntries
in interface ReadOnlyBroadcastState<K,V>
@VisibleForTesting public MapSerializer<K,V> getInternalMapCopySerializer()
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.