public class StateFetchingIterators
extends java.lang.Object
Iterator of ByteStrings.| Modifier and Type | Method and Description |
|---|---|
static <T> org.apache.beam.fn.harness.state.StateFetchingIterators.CachingStateIterable<T> |
readAllAndDecodeStartingFrom(Cache<?,?> cache,
BeamFnStateClient beamFnStateClient,
org.apache.beam.model.fnexecution.v1.BeamFnApi.StateRequest stateRequestForFirstChunk,
org.apache.beam.sdk.coders.Coder<T> valueCoder)
This adapter handles using the continuation token to provide iteration over all the elements
returned by the Beam Fn State API using the supplied state client, state request for the first
chunk of the state stream, and a value decoder.
|
public static <T> org.apache.beam.fn.harness.state.StateFetchingIterators.CachingStateIterable<T> readAllAndDecodeStartingFrom(Cache<?,?> cache, BeamFnStateClient beamFnStateClient, org.apache.beam.model.fnexecution.v1.BeamFnApi.StateRequest stateRequestForFirstChunk, org.apache.beam.sdk.coders.Coder<T> valueCoder)
The cache's eviction policy will control how much if any the pages are stored in memory and for how long mutations are stored.
Note: Mutation of the iterable only mutates the underlying cache. It is expected that mutations will have been persisted to the runner such that future reads will reflect those changes.
cache - A cache instance used to store pages of elements and any pending requests. The
cache should be namespaced for this object to prevent collisions.beamFnStateClient - A client for handling state requests.stateRequestForFirstChunk - A fully populated state request for the first (and possibly
only) chunk of a state stream. This state request will be populated with a continuation
token to request further chunks of the stream if required.valueCoder - A coder for decoding the state stream.