IN
- Type of the value that can be added to the state.OUT
- Type of the value that can be retrieved from the state.@PublicEvolving public interface AppendingState<IN,OUT> extends State
The state is accessed and modified by user functions, and checkpointed consistently by the system as part of the distributed snapshots.
The state is only accessible by functions applied on a KeyedStream
. The key is
automatically supplied by the system, so the function always sees the value mapped to the key of
the current element. That way, the system can handle stream and state partitioning consistently
together.
Modifier and Type | Method and Description |
---|---|
void |
add(IN value)
Updates the operator state accessible by
get() by adding the given value to the list
of values. |
OUT |
get()
Returns the current value for the state.
|
OUT get() throws Exception
NOTE TO IMPLEMENTERS: if the state is empty, then this method should return null
.
null
if the
state is empty.Exception
- Thrown if the system cannot access the state.void add(IN value) throws Exception
get()
by adding the given value to the list
of values. The next time 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.
value
- The new value for the state.Exception
- Thrown if the system cannot access the state.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.