@Internal public class CheckpointedInputGate extends Object implements PullingAsyncDataInput<BufferOrEvent>, Closeable
CheckpointedInputGate
uses CheckpointBarrierHandler
to handle incoming CheckpointBarrier
from the InputGate
.AvailabilityProvider.AvailabilityHelper
AVAILABLE
Constructor and Description |
---|
CheckpointedInputGate(InputGate inputGate,
CheckpointBarrierHandler barrierHandler)
Creates a new checkpoint stream aligner.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Cleans up all internally held resources.
|
CompletableFuture<Void> |
getAllBarriersReceivedFuture(long checkpointId) |
CompletableFuture<?> |
getAvailableFuture() |
InputChannel |
getChannel(int channelIndex) |
List<InputChannelInfo> |
getChannelInfos() |
int |
getNumberOfInputChannels() |
boolean |
isFinished() |
Optional<BufferOrEvent> |
pollNext()
Poll the next element.
|
void |
spillInflightBuffers(long checkpointId,
int channelIndex,
ChannelStateWriter channelStateWriter) |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isApproximatelyAvailable, isAvailable
public CheckpointedInputGate(InputGate inputGate, CheckpointBarrierHandler barrierHandler)
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.barrierHandler
- Handler that controls which channels are blocked.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 void spillInflightBuffers(long checkpointId, int channelIndex, ChannelStateWriter channelStateWriter) throws IOException
IOException
public CompletableFuture<Void> getAllBarriersReceivedFuture(long checkpointId)
public boolean isFinished()
isFinished
in interface PullingAsyncDataInput<BufferOrEvent>
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
- Thrown if the cleanup of I/O resources failed.public int getNumberOfInputChannels()
public InputChannel getChannel(int channelIndex)
public List<InputChannelInfo> getChannelInfos()
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.