Interface SupportsWriterState<InputT,WriterStateT>
-
- Type Parameters:
InputT
- The type of the sink's inputWriterStateT
- The type of the sink writer's state
- All Known Implementing Classes:
AsyncSinkBase
,FileSink
@Public public interface SupportsWriterState<InputT,WriterStateT>
A mixin interface for aSink
which supports a statefulStatefulSinkWriter
.The
Sink
needs to be serializable. All configuration should be validated eagerly. The respective sink writers are transient and will only be created in the subtasks on the taskmanagers.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
SupportsWriterState.WithCompatibleState
A mix-in forSupportsWriterState
that allows users to migrate from a sink with a compatible state to this sink.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description SimpleVersionedSerializer<WriterStateT>
getWriterStateSerializer()
Any stateful sink needs to provide this state serializer and implementStatefulSinkWriter.snapshotState(long)
properly.StatefulSinkWriter<InputT,WriterStateT>
restoreWriter(WriterInitContext context, Collection<WriterStateT> recoveredState)
Create aStatefulSinkWriter
from a recovered state.
-
-
-
Method Detail
-
restoreWriter
StatefulSinkWriter<InputT,WriterStateT> restoreWriter(WriterInitContext context, Collection<WriterStateT> recoveredState) throws IOException
Create aStatefulSinkWriter
from a recovered state.- Parameters:
context
- the runtime context.recoveredState
- the state to recover from.- Returns:
- A sink writer.
- Throws:
IOException
- for any failure during creation.
-
getWriterStateSerializer
SimpleVersionedSerializer<WriterStateT> getWriterStateSerializer()
Any stateful sink needs to provide this state serializer and implementStatefulSinkWriter.snapshotState(long)
properly. The respective state is used inrestoreWriter(WriterInitContext, Collection)
on recovery.- Returns:
- the serializer of the writer's state type.
-
-