Interface CheckpointStreamFactory

All Known Subinterfaces:
CheckpointStorageLocation
All Known Implementing Classes:
FsCheckpointStorageLocation, FsCheckpointStreamFactory, FsMergingCheckpointStorageLocation, MemCheckpointStreamFactory, NonPersistentMetadataCheckpointStorageLocation, PersistentMetadataCheckpointStorageLocation

public interface CheckpointStreamFactory
A factory for checkpoint output streams, which are used to persist data for checkpoints.

Stream factories can be created from the CheckpointStorageAccess through CheckpointStorageWorkerView.resolveCheckpointStorageLocation(long, CheckpointStorageLocationReference).

  • Method Details

    • createCheckpointStateOutputStream

      CheckpointStateOutputStream createCheckpointStateOutputStream(CheckpointedStateScope scope) throws IOException
      Creates an new CheckpointStateOutputStream. When the stream is closed, it returns a state handle that can retrieve the state back.
      Parameters:
      scope - The state's scope, whether it is exclusive or shared.
      Returns:
      An output stream that writes state for the given checkpoint.
      Throws:
      IOException - Exceptions may occur while creating the stream and should be forwarded.
    • canFastDuplicate

      boolean canFastDuplicate(StreamStateHandle stateHandle, CheckpointedStateScope scope) throws IOException
      Tells if we can duplicate the given StreamStateHandle into the path corresponding to the given CheckpointedStateScope.

      This should be a rather cheap operation, preferably not involving any remote accesses.

      Parameters:
      stateHandle - The handle to duplicate
      scope - Scope determining the location to duplicate into
      Returns:
      true, if we can perform the duplication
      Throws:
      IOException
    • duplicate

      Duplicates StreamStateHandle into the path corresponding to * the given CheckpointedStateScope.

      You should first check if you can duplicate with canFastDuplicate(StreamStateHandle, CheckpointedStateScope).

      Parameters:
      stateHandles - The handles to duplicate
      scope - Scope determining the location to duplicate into
      Returns:
      The duplicated handle
      Throws:
      IOException
    • reusePreviousStateHandle

      default void reusePreviousStateHandle(Collection<? extends StreamStateHandle> previousHandle)
      A callback method when some previous handle is reused. It is needed by the file merging mechanism (FLIP-306) which will manage the life cycle of underlying files by file-reusing information.
      Parameters:
      previousHandle - the previous handles that will be reused.
    • couldReuseStateHandle

      default boolean couldReuseStateHandle(StreamStateHandle stateHandle)
      A pre-check hook before the checkpoint writer want to reuse a state handle, if this returns false, it is not recommended for the writer to rewrite the state file considering the space amplification.
      Parameters:
      stateHandle - the handle to be reused.
      Returns:
      true if it can be reused.