StreamTransferTask (apache-cassandra API)
Date: 2018-02-12

org.apache.cassandra.streaming

## Class StreamTransferTask

- java.lang.Object
- - org.apache.cassandra.streaming.StreamTask
  - - org.apache.cassandra.streaming.StreamTransferTask

-     public class StreamTransferTask
      extends StreamTask

  StreamTransferTask sends sections of SSTable files in certain ColumnFamily.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.Map<java.lang.Integer,OutgoingFileMessage>` | `files`

    - ### Fields inherited from class org.apache.cassandra.streaming.StreamTask

      `cfId, session`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StreamTransferTask(StreamSession session, java.util.UUID cfId)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `abort()` Abort the task.
    `void` | `addTransferFile(Ref<SSTableReader> ref, long estimatedKeys, java.util.List<Pair<java.lang.Long,java.lang.Long>> sections, long repairedAt)`
    `void` | `complete(int sequenceNumber)` Received ACK for file at `sequenceNumber`.
    `OutgoingFileMessage` | `createMessageForRetry(int sequenceNumber)`
    `java.util.Collection<OutgoingFileMessage>` | `getFileMessages()`
    `int` | `getTotalNumberOfFiles()`
    `long` | `getTotalSize()`
    `java.util.concurrent.ScheduledFuture` | `scheduleTimeout(int sequenceNumber, long time, java.util.concurrent.TimeUnit unit)` Schedule timeout task to release reference for file sent.

    - ### Methods inherited from class org.apache.cassandra.streaming.StreamTask

      `getSummary`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### files

          protected final java.util.Map<java.lang.Integer,OutgoingFileMessage> files

  - ### Constructor Detail

    - #### StreamTransferTask

          public StreamTransferTask(StreamSession session,
                                    java.util.UUID cfId)

  - ### Method Detail

    - #### addTransferFile

          public void addTransferFile(Ref<SSTableReader> ref,
                                      long estimatedKeys,
                                      java.util.List<Pair<java.lang.Long,java.lang.Long>> sections,
                                      long repairedAt)

    - #### complete

          public void complete(int sequenceNumber)

      Received ACK for file at `sequenceNumber`.
      Parameters:
        `sequenceNumber` - sequence number of file

    - #### abort

          public void abort()

      Description copied from class: `StreamTask`
      Abort the task. Subclass should implement cleaning up resources.
      Specified by:
        `abort` in class `StreamTask`

    - #### getTotalNumberOfFiles

          public int getTotalNumberOfFiles()

      Specified by:
        `getTotalNumberOfFiles` in class `StreamTask`
      Returns:
        total number of files this task receives/streams.

    - #### getTotalSize

          public long getTotalSize()

      Specified by:
        `getTotalSize` in class `StreamTask`
      Returns:
        total bytes expected to receive

    - #### getFileMessages

          public java.util.Collection<OutgoingFileMessage> getFileMessages()

    - #### createMessageForRetry

          public OutgoingFileMessage createMessageForRetry(int sequenceNumber)

    - #### scheduleTimeout

          public java.util.concurrent.ScheduledFuture scheduleTimeout(int sequenceNumber,
                                                                      long time,
                                                                      java.util.concurrent.TimeUnit unit)

      Schedule timeout task to release reference for file sent. When not receiving ACK after sending to receiver in given time, the task will release reference.
      Parameters:
        `sequenceNumber` - sequence number of file sent.
        `time` - time to timeout
        `unit` - unit of given time
      Returns:
        scheduled future for timeout task

Copyright © 2018 The Apache Software Foundation