@Internal public class CheckpointedInputGate extends Object implements PullingAsyncDataInput<BufferOrEvent>
CheckpointedInputGate
uses CheckpointBarrierHandler
to handle incoming
CheckpointBarrier
from the InputGate
.AvailabilityProvider.AvailabilityHelper
AVAILABLE
Constructor and Description |
---|
CheckpointedInputGate(InputGate inputGate,
BufferStorage bufferStorage,
CheckpointBarrierHandler barrierHandler) |
CheckpointedInputGate(InputGate inputGate,
BufferStorage bufferStorage,
CheckpointBarrierHandler barrierHandler,
int channelIndexOffset)
Creates a new checkpoint stream aligner.
|
CheckpointedInputGate(InputGate inputGate,
BufferStorage bufferStorage,
String taskName,
AbstractInvokable toNotifyOnCheckpoint) |
Modifier and Type | Method and Description |
---|---|
void |
cleanup()
Cleans up all internally held resources.
|
long |
getAlignmentDurationNanos()
Gets the time that the latest alignment took, in nanoseconds.
|
CompletableFuture<?> |
getAvailableFuture() |
long |
getLatestCheckpointId()
Gets the ID defining the current pending, or just completed, checkpoint.
|
int |
getNumberOfInputChannels() |
boolean |
isEmpty()
Checks if the barrier handler has buffered any data internally.
|
boolean |
isFinished() |
Optional<BufferOrEvent> |
pollNext()
Poll the next element.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isApproximatelyAvailable, isAvailable
public CheckpointedInputGate(InputGate inputGate, BufferStorage bufferStorage, String taskName, @Nullable AbstractInvokable toNotifyOnCheckpoint)
public CheckpointedInputGate(InputGate inputGate, BufferStorage bufferStorage, CheckpointBarrierHandler barrierHandler)
public CheckpointedInputGate(InputGate inputGate, BufferStorage bufferStorage, CheckpointBarrierHandler barrierHandler, int channelIndexOffset)
The aligner will allow only alignments that buffer up to the given number of bytes. When that number is exceeded, it will stop the alignment and notify the task that the checkpoint has been cancelled.
inputGate
- The input gate to draw the buffers and events from.bufferStorage
- The storage to hold the buffers and events for blocked channels.barrierHandler
- Handler that controls which channels are blocked.channelIndexOffset
- Optional offset added to channelIndex returned from the inputGate
before passing it to the barrierHandler.public CompletableFuture<?> getAvailableFuture()
getAvailableFuture
in interface AvailabilityProvider
public Optional<BufferOrEvent> pollNext() throws Exception
PullingAsyncDataInput
pollNext
in interface PullingAsyncDataInput<BufferOrEvent>
Optional.empty()
will be returned if there is no data to return or
if PullingAsyncDataInput.isFinished()
returns true. Otherwise Optional.of(element)
.Exception
public boolean isEmpty()
True
, if no data is buffered internally, false
otherwise.public boolean isFinished()
isFinished
in interface PullingAsyncDataInput<BufferOrEvent>
public void cleanup() throws IOException
IOException
- Thrown if the cleanup of I/O resources failed.public long getLatestCheckpointId()
public long getAlignmentDurationNanos()
public int getNumberOfInputChannels()
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.