Package org.apache.cassandra.streaming
Class StreamPlan
java.lang.Object
org.apache.cassandra.streaming.StreamPlan
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
ConstructorsConstructorDescriptionStreamPlan(StreamOperation streamOperation) Start building stream plan.StreamPlan(StreamOperation streamOperation, boolean connectSequentially) StreamPlan(StreamOperation streamOperation, int connectionsPerHost, boolean connectSequentially, TimeUUID pendingRepair, PreviewKind previewKind) -
Method Summary
Modifier and TypeMethodDescriptionSet custom StreamConnectionFactory to be used for establishing connectionexecute()Execute thisStreamPlanasynchronously.flushBeforeTransfer(boolean flushBeforeTransfer) Set flushBeforeTransfer option.booleanhandlers()booleanisEmpty()listeners(StreamEventHandler handler, StreamEventHandler... handlers) planId()requestRanges(InetAddressAndPort from, String keyspace, RangesAtEndpoint fullRanges, RangesAtEndpoint transientRanges) Request data inkeyspaceandrangesfrom specific node.requestRanges(InetAddressAndPort from, String keyspace, RangesAtEndpoint fullRanges, RangesAtEndpoint transientRanges, String... columnFamilies) Request data incolumnFamiliesunderkeyspaceandrangesfrom specific node.transferRanges(InetAddressAndPort to, String keyspace, RangesAtEndpoint replicas, String... columnFamilies) Add transfer task to send data of specificcolumnFamiliesunderkeyspaceandranges.transferStreams(InetAddressAndPort to, Collection<OutgoingStream> streams) Add transfer task to send given streams
-
Constructor Details
-
StreamPlan
Start building stream plan.- Parameters:
streamOperation- Stream streamOperation that describes this StreamPlan
-
StreamPlan
-
StreamPlan
public StreamPlan(StreamOperation streamOperation, int connectionsPerHost, boolean connectSequentially, TimeUUID pendingRepair, PreviewKind previewKind)
-
-
Method Details
-
requestRanges
public StreamPlan requestRanges(InetAddressAndPort from, String keyspace, RangesAtEndpoint fullRanges, RangesAtEndpoint transientRanges) Request data inkeyspaceandrangesfrom 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, String keyspace, RangesAtEndpoint fullRanges, RangesAtEndpoint transientRanges, String... columnFamilies) Request data incolumnFamiliesunderkeyspaceandrangesfrom 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, String keyspace, RangesAtEndpoint replicas, String... columnFamilies) Add transfer task to send data of specificcolumnFamiliesunderkeyspaceandranges.- Parameters:
to- endpoint address of receiverkeyspace- name of keyspacereplicas- ranges to sendcolumnFamilies- specific column families- Returns:
- this object for chaining
-
transferStreams
Add transfer task to send given streams- Parameters:
to- endpoint address of receiverstreams- streams to send- Returns:
- this object for chaining
-
listeners
-
planId
-
streamOperation
-
handlers
-
connectionFactory
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
Execute thisStreamPlanasynchronously.- Returns:
- Future
StreamStatethat you can use to listen on progress of streaming.
-
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
-
getFlushBeforeTransfer
public boolean getFlushBeforeTransfer() -
getCoordinator
-