InputT
- the type of values added to the stateAccumT
- the type of accumulatorOutputT
- the type of value extracted from the state@Experimental(value=STATE) public interface CombiningState<InputT,AccumT,OutputT> extends GroupingState<InputT,OutputT>
ReadableState
cell defined by a Combine.CombineFn
, accepting multiple input values,
combining them as specified into accumulators, and producing a single output value.
Implementations of this form of state are expected to implement GroupingState.add(InputT)
efficiently, not
via a sequence of read-modify-write.
Modifier and Type | Method and Description |
---|---|
void |
addAccum(AccumT accum)
Add an accumulator to this state cell.
|
AccumT |
getAccum()
Read the merged accumulator for this state cell.
|
AccumT |
mergeAccumulators(java.lang.Iterable<AccumT> accumulators)
Merge the given accumulators according to the underlying
Combine.CombineFn . |
CombiningState<InputT,AccumT,OutputT> |
readLater()
Indicate that the value will be read later.
|
add, isEmpty
read
AccumT getAccum()
readLater()
is sufficient to prefetch for this.void addAccum(AccumT accum)
AccumT mergeAccumulators(java.lang.Iterable<AccumT> accumulators)
Combine.CombineFn
.CombiningState<InputT,AccumT,OutputT> readLater()
ReadableState
This allows an implementation to start an asynchronous prefetch or to include this state in the next batch of reads.
readLater
in interface GroupingState<InputT,OutputT>
readLater
in interface ReadableState<OutputT>