Package org.apache.beam.sdk.state
Interface ReadableState<T>
-
- Type Parameters:
T
- The type of value returned byread()
.
- All Known Subinterfaces:
BagState<T>
,CombiningState<InputT,AccumT,OutputT>
,GroupingState<InputT,OutputT>
,OrderedListState<T>
,SetState<T>
,ValueState<T>
,WatermarkHoldState
@Experimental(STATE) public interface ReadableState<T>
AState
that can be read viaread()
.Use
readLater()
for marking several states for prefetching. Runners can potentially batch these into one read.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
read()
Read the current value, blocking until it is available.ReadableState<T>
readLater()
Indicate that the value will be read later.
-
-
-
Method Detail
-
read
T read()
Read the current value, blocking until it is available.If there will be many calls to
read()
for different state in short succession, you should first callreadLater()
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.
-
readLater
ReadableState<T> readLater()
Indicate 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.
- Returns:
- this for convenient chaining
-
-