org.apache.cassandra.streaming

## Class StreamPlan

- java.lang.Object
- - org.apache.cassandra.streaming.StreamPlan

-     public class StreamPlan
      extends java.lang.Object

  `StreamPlan` is a helper class that builds StreamOperation of given configuration. This is the class you want to use for building streaming plan and starting streaming.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `StreamPlan(java.lang.String description)` Start building stream plan.
    `StreamPlan(java.lang.String description, boolean keepSSTableLevels)`
    `StreamPlan(java.lang.String description, long repairedAt, int connectionsPerHost, boolean keepSSTableLevels, boolean isIncremental)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `StreamPlan` | `connectionFactory(StreamConnectionFactory factory)` Set custom StreamConnectionFactory to be used for establishing connection
    `StreamResultFuture` | `execute()` Execute this `StreamPlan` asynchronously.
    `StreamPlan` | `flushBeforeTransfer(boolean flushBeforeTransfer)` Set flushBeforeTransfer option.
    `boolean` | `isEmpty()`
    `StreamPlan` | `listeners(StreamEventHandler handler, StreamEventHandler... handlers)`
    `StreamPlan` | `requestRanges(java.net.InetAddress from, java.net.InetAddress connecting, java.lang.String keyspace, java.util.Collection<Range<Token>> ranges)` Request data in `keyspace` and `ranges` from specific node.
    `StreamPlan` | `requestRanges(java.net.InetAddress from, java.net.InetAddress connecting, java.lang.String keyspace, java.util.Collection<Range<Token>> ranges, java.lang.String... columnFamilies)` Request data in `columnFamilies` under `keyspace` and `ranges` from specific node.
    `StreamPlan` | `transferFiles(java.net.InetAddress to, java.util.Collection<StreamSession.SSTableStreamingSections> sstableDetails)` Add transfer task to send given SSTable files.
    `StreamPlan` | `transferRanges(java.net.InetAddress to, java.net.InetAddress connecting, java.lang.String keyspace, java.util.Collection<Range<Token>> ranges)` Add transfer task to send data of specific keyspace and ranges.
    `StreamPlan` | `transferRanges(java.net.InetAddress to, java.net.InetAddress connecting, java.lang.String keyspace, java.util.Collection<Range<Token>> ranges, java.lang.String... columnFamilies)` Add transfer task to send data of specific `columnFamilies` under `keyspace` and `ranges`.
    `StreamPlan` | `transferRanges(java.net.InetAddress to, java.lang.String keyspace, java.util.Collection<Range<Token>> ranges, java.lang.String... columnFamilies)` Add transfer task to send data of specific `columnFamilies` under `keyspace` and `ranges`.

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

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

- - ### Constructor Detail

    - #### StreamPlan

          public StreamPlan(java.lang.String description)

      Start building stream plan.
      Parameters:
        `description` - Stream type that describes this StreamPlan

    - #### StreamPlan

          public StreamPlan(java.lang.String description,
                            boolean keepSSTableLevels)

    - #### StreamPlan

          public StreamPlan(java.lang.String description,
                            long repairedAt,
                            int connectionsPerHost,
                            boolean keepSSTableLevels,
                            boolean isIncremental)

  - ### Method Detail

    - #### requestRanges

          public StreamPlan requestRanges(java.net.InetAddress from,
                                          java.net.InetAddress connecting,
                                          java.lang.String keyspace,
                                          java.util.Collection<Range<Token>> ranges)

      Request data in `keyspace` and `ranges` from specific node.
      Parameters:
        `from` - endpoint address to fetch data from.
        `connecting` - Actual connecting address for the endpoint
        `keyspace` - name of keyspace
        `ranges` - ranges to fetch
      Returns:
        this object for chaining

    - #### requestRanges

          public StreamPlan requestRanges(java.net.InetAddress from,
                                          java.net.InetAddress connecting,
                                          java.lang.String keyspace,
                                          java.util.Collection<Range<Token>> ranges,
                                          java.lang.String... columnFamilies)

      Request data in `columnFamilies` under `keyspace` and `ranges` from specific node.
      Parameters:
        `from` - endpoint address to fetch data from.
        `connecting` - Actual connecting address for the endpoint
        `keyspace` - name of keyspace
        `ranges` - ranges to fetch
        `columnFamilies` - specific column families
      Returns:
        this object for chaining

    - #### transferRanges

          public StreamPlan transferRanges(java.net.InetAddress to,
                                           java.lang.String keyspace,
                                           java.util.Collection<Range<Token>> ranges,
                                           java.lang.String... columnFamilies)

      Add transfer task to send data of specific `columnFamilies` under `keyspace` and `ranges`.
      See Also:
        `transferRanges(java.net.InetAddress, java.net.InetAddress, String, java.util.Collection, String...)`

    - #### transferRanges

          public StreamPlan transferRanges(java.net.InetAddress to,
                                           java.net.InetAddress connecting,
                                           java.lang.String keyspace,
                                           java.util.Collection<Range<Token>> ranges)

      Add transfer task to send data of specific keyspace and ranges.
      Parameters:
        `to` - endpoint address of receiver
        `connecting` - Actual connecting address of the endpoint
        `keyspace` - name of keyspace
        `ranges` - ranges to send
      Returns:
        this object for chaining

    - #### transferRanges

          public StreamPlan transferRanges(java.net.InetAddress to,
                                           java.net.InetAddress connecting,
                                           java.lang.String keyspace,
                                           java.util.Collection<Range<Token>> ranges,
                                           java.lang.String... columnFamilies)

      Add transfer task to send data of specific `columnFamilies` under `keyspace` and `ranges`.
      Parameters:
        `to` - endpoint address of receiver
        `connecting` - Actual connecting address of the endpoint
        `keyspace` - name of keyspace
        `ranges` - ranges to send
        `columnFamilies` - specific column families
      Returns:
        this object for chaining

    - #### transferFiles

          public StreamPlan transferFiles(java.net.InetAddress to,
                                          java.util.Collection<StreamSession.SSTableStreamingSections> sstableDetails)

      Add transfer task to send given SSTable files.
      Parameters:
        `to` - endpoint address of receiver
        `sstableDetails` - sstables with file positions and estimated key count. this collection will be modified to remove those files that are successfully handed off
      Returns:
        this object for chaining

    - #### listeners

          public StreamPlan listeners(StreamEventHandler handler,
                                      StreamEventHandler... handlers)

    - #### connectionFactory

          public StreamPlan connectionFactory(StreamConnectionFactory factory)

      Set custom StreamConnectionFactory to be used for establishing connection
      Parameters:
        `factory` - StreamConnectionFactory to use
      Returns:
        self

    - #### isEmpty

          public boolean isEmpty()

      Returns:
        true if this plan has no plan to execute

    - #### execute

          public StreamResultFuture execute()

      Execute this `StreamPlan` asynchronously.
      Returns:
        Future `StreamState` that you can use to listen on progress of streaming.

    - #### flushBeforeTransfer

          public StreamPlan flushBeforeTransfer(boolean flushBeforeTransfer)

      Set flushBeforeTransfer option. When it's true, will flush before streaming ranges. (Default: true)
      Parameters:
        `flushBeforeTransfer` - set to true when the node should flush before transfer
      Returns:
        this object for chaining

Copyright © 2018 The Apache Software Foundation