T
- The type of the objects stored in the state.public class SimpleVersionedListState<T> extends Object implements ListState<T>
ListState
that uses a SimpleVersionedSerializer
instead of a TypeSerializer
.
The state wraps a ListState
of type byte[]
, meaning it internally keeps only
bytes and lazily deserializes them into objects. This has two major implications, compared to a
ListState
states that uses a TypeSerializer
:
TypeSerializer
,
because of extra copies into byte arrays and extra version encodings.
Constructor and Description |
---|
SimpleVersionedListState(ListState<byte[]> rawState,
SimpleVersionedSerializer<T> serializer)
Creates a new SimpleVersionedListState that reads and writes bytes from the given raw
ListState with the given serializer.
|
Modifier and Type | Method and Description |
---|---|
void |
add(T value)
Updates the operator state accessible by
AppendingState.get() by adding the given value to the list
of values. |
void |
addAll(List<T> values)
Updates the operator state accessible by
AppendingState.get() by adding the given values to
existing list of values. |
void |
clear()
Removes the value mapped under the current key.
|
Iterable<T> |
get()
Returns the current value for the state.
|
void |
update(List<T> values)
Updates the operator state accessible by
AppendingState.get() by updating existing values to to the
given list of values. |
public SimpleVersionedListState(ListState<byte[]> rawState, SimpleVersionedSerializer<T> serializer)
public void update(@Nullable List<T> values) throws Exception
ListState
AppendingState.get()
by updating existing values to to the
given list of values. The next time AppendingState.get()
is called (for the same state partition)
the returned state will represent the updated list.
If null or an empty list is passed in, the state value will be null.
public void addAll(@Nullable List<T> values) throws Exception
ListState
AppendingState.get()
by adding the given values to
existing list of values. The next time AppendingState.get()
is called (for the same state
partition) the returned state will represent the updated list.
If null or an empty list is passed in, the state value remains unchanged.
public Iterable<T> get() throws Exception
AppendingState
NOTE TO IMPLEMENTERS: if the state is empty, then this method should return null
.
public void add(T value) throws Exception
AppendingState
AppendingState.get()
by adding the given value to the list
of values. The next time AppendingState.get()
is called (for the same state partition) the returned
state will represent the updated list.
If null is passed in, the state value will remain unchanged.
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.