Interface BagState<T>
- Type Parameters:
T- The type of elements in the bag.
- All Superinterfaces:
GroupingState<T,,Iterable<T>> ReadableState<Iterable<T>>,State
ReadableState cell containing a bag of values. Items can be added to the bag and the
contents read out.
Implementations of this form of state are expected to implement GroupingState.add(InputT) efficiently, not
via a sequence of read-modify-write.
-
Method Summary
Methods inherited from interface org.apache.beam.sdk.state.GroupingState
add, isEmpty
-
Method Details
-
read
Description copied from interface:ReadableStateRead the current value, blocking until it is available.If there will be many calls to
ReadableState.read()for different state in short succession, you should first callReadableState.readLater()for all of them so the reads can potentially be batched (depending on the underlying implementation}.The returned object should be independent of the underlying state. Any direct modification of the returned object should not modify state without going through the appropriate state interface, and modification to the state should not be mirrored in the returned object.
- Specified by:
readin interfaceReadableState<T>
-
readLater
Description copied from interface:ReadableStateIndicate that the value will be read later.This allows an implementation to start an asynchronous prefetch or to include this state in the next batch of reads.
- Specified by:
readLaterin interfaceGroupingState<T,Iterable<T>> - Specified by:
readLaterin interfaceReadableState<T>- Returns:
- this for convenient chaining
-