Class SplitTracker


  • @Internal
    public class SplitTracker
    extends Object
    This class is used to track shard hierarchy.
    • Method Detail

      • addSplits

        public void addSplits​(Collection<KinesisShardSplit> splitsToAdd)
        Add newly discovered splits to tracker.
        Parameters:
        splitsToAdd - collection of splits to add to tracking
      • markAsAssigned

        public void markAsAssigned​(Collection<KinesisShardSplit> splitsToAssign)
        Mark splits as assigned. Assigned splits will no longer be returned as pending splits.
        Parameters:
        splitsToAssign - collection of splits to mark as assigned
      • markAsFinished

        public void markAsFinished​(Collection<String> finishedSplitIds)
        Mark splits with specified ids as finished.
        Parameters:
        finishedSplitIds - collection of split ids to mark as finished
      • isAssigned

        public boolean isAssigned​(String splitId)
        Checks if split with specified id had been assigned to the reader.
        Parameters:
        splitId - split id
        Returns:
        true if split had been assigned, otherwise false
      • splitsAvailableForAssignment

        public List<KinesisShardSplit> splitsAvailableForAssignment()
        Returns list of splits that can be assigned to readers. Does not include splits that are already assigned or finished. If shard ordering is enabled, only splits with finished parents will be returned.
        Returns:
        list of splits that can be assigned to readers.
      • snapshotState

        public List<KinesisShardSplitWithAssignmentStatus> snapshotState​(long checkpointId)
        Prepare split graph representation to store in state. Method returns only splits that are currently assigned to readers or unassigned. Finished splits are not included in the result.
        Parameters:
        checkpointId - id of the checkpoint
        Returns:
        list of splits with current assignment status