Package 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 Description StreamPlan(StreamOperation streamOperation)
Start building stream plan.StreamPlan(StreamOperation streamOperation, boolean connectSequentially)
StreamPlan(StreamOperation streamOperation, int connectionsPerHost, boolean connectSequentially, TimeUUID pendingRepair, PreviewKind previewKind)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StreamPlan
connectionFactory(StreamingChannel.Factory factory)
Set custom StreamConnectionFactory to be used for establishing connectionStreamResultFuture
execute()
Execute thisStreamPlan
asynchronously.StreamPlan
flushBeforeTransfer(boolean flushBeforeTransfer)
Set flushBeforeTransfer option.StreamCoordinator
getCoordinator()
boolean
getFlushBeforeTransfer()
TimeUUID
getPendingRepair()
java.util.List<StreamEventHandler>
handlers()
boolean
isEmpty()
StreamPlan
listeners(StreamEventHandler handler, StreamEventHandler... handlers)
TimeUUID
planId()
StreamPlan
requestRanges(InetAddressAndPort from, java.lang.String keyspace, RangesAtEndpoint fullRanges, RangesAtEndpoint transientRanges)
Request data inkeyspace
andranges
from specific node.StreamPlan
requestRanges(InetAddressAndPort from, java.lang.String keyspace, RangesAtEndpoint fullRanges, RangesAtEndpoint transientRanges, java.lang.String... columnFamilies)
Request data incolumnFamilies
underkeyspace
andranges
from specific node.StreamOperation
streamOperation()
StreamPlan
transferRanges(InetAddressAndPort to, java.lang.String keyspace, RangesAtEndpoint replicas, java.lang.String... columnFamilies)
Add transfer task to send data of specificcolumnFamilies
underkeyspace
andranges
.StreamPlan
transferStreams(InetAddressAndPort to, java.util.Collection<OutgoingStream> streams)
Add transfer task to send given streams
-
-
-
Constructor Detail
-
StreamPlan
public StreamPlan(StreamOperation streamOperation)
Start building stream plan.- Parameters:
streamOperation
- Stream streamOperation that describes this StreamPlan
-
StreamPlan
public StreamPlan(StreamOperation streamOperation, boolean connectSequentially)
-
StreamPlan
public StreamPlan(StreamOperation streamOperation, int connectionsPerHost, boolean connectSequentially, TimeUUID pendingRepair, PreviewKind previewKind)
-
-
Method Detail
-
requestRanges
public StreamPlan requestRanges(InetAddressAndPort from, java.lang.String keyspace, RangesAtEndpoint fullRanges, RangesAtEndpoint transientRanges)
Request data inkeyspace
andranges
from specific node. Here, we have to encode both _local_ range transientness (encoded in Replica itself, in RangesAtEndpoint) and _remote_ (source) range transientmess, which is encoded by splitting ranges into full and transient. At the other end the distinction between full and transient is ignored it just used the transient status of the Replica objects we send to determine what to send. The real reason we have this split down to StreamRequest is that on completion StreamRequest is used to write to the system table tracking what has already been streamed. At that point since we only have the local Replica instances so we don't know what we got from the remote. We preserve that here by splitting based on the remotes transient status.- Parameters:
from
- endpoint address to fetch data from.keyspace
- name of keyspacefullRanges
- ranges to fetch that from provides the full version oftransientRanges
- ranges to fetch that from provides only transient data of- Returns:
- this object for chaining
-
requestRanges
public StreamPlan requestRanges(InetAddressAndPort from, java.lang.String keyspace, RangesAtEndpoint fullRanges, RangesAtEndpoint transientRanges, java.lang.String... columnFamilies)
Request data incolumnFamilies
underkeyspace
andranges
from specific node.- Parameters:
from
- endpoint address to fetch data from.keyspace
- name of keyspacefullRanges
- ranges to fetch that from provides the full data fortransientRanges
- ranges to fetch that from provides only transient data forcolumnFamilies
- specific column families- Returns:
- this object for chaining
-
transferRanges
public StreamPlan transferRanges(InetAddressAndPort to, java.lang.String keyspace, RangesAtEndpoint replicas, java.lang.String... columnFamilies)
Add transfer task to send data of specificcolumnFamilies
underkeyspace
andranges
.- Parameters:
to
- endpoint address of receiverkeyspace
- name of keyspacereplicas
- ranges to sendcolumnFamilies
- specific column families- Returns:
- this object for chaining
-
transferStreams
public StreamPlan transferStreams(InetAddressAndPort to, java.util.Collection<OutgoingStream> streams)
Add transfer task to send given streams- Parameters:
to
- endpoint address of receiverstreams
- streams to send- Returns:
- this object for chaining
-
listeners
public StreamPlan listeners(StreamEventHandler handler, StreamEventHandler... handlers)
-
planId
public TimeUUID planId()
-
streamOperation
public StreamOperation streamOperation()
-
handlers
public java.util.List<StreamEventHandler> handlers()
-
connectionFactory
public StreamPlan connectionFactory(StreamingChannel.Factory 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 thisStreamPlan
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
-
getPendingRepair
public TimeUUID getPendingRepair()
-
getFlushBeforeTransfer
public boolean getFlushBeforeTransfer()
-
getCoordinator
public StreamCoordinator getCoordinator()
-
-