@PublicEvolving public final class ImmutableValueState<V> extends Object implements ValueState<V>
ValueState
that does not allow for modifications.
This is the result returned when querying Flink's keyed state using the
Queryable State Client
and
providing an ValueStateDescriptor
.
Modifier and Type | Field and Description |
---|---|
protected static UnsupportedOperationException |
MODIFICATION_ATTEMPT_ERROR |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes the value mapped under the current key.
|
static <V> ImmutableValueState<V> |
createState(ValueStateDescriptor<V> stateDescriptor,
byte[] serializedState) |
void |
update(V newValue)
Updates the operator state accessible by
ValueState.value() to the given
value. |
V |
value()
Returns the current value for the state.
|
protected static final UnsupportedOperationException MODIFICATION_ATTEMPT_ERROR
public V value()
ValueState
If you didn't specify a default value when creating the ValueStateDescriptor
this will return null
when to value was previously set using ValueState.update(Object)
.
value
in interface ValueState<V>
public void update(V newValue)
ValueState
ValueState.value()
to the given
value. The next time ValueState.value()
is called (for the same state
partition) the returned state will represent the updated value. When a
partitioned state is updated with null, the state for the current key
will be removed and the default value is returned on the next access.update
in interface ValueState<V>
newValue
- The new value for the state.public void clear()
State
public static <V> ImmutableValueState<V> createState(ValueStateDescriptor<V> stateDescriptor, byte[] serializedState) throws IOException
IOException
Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.