本文整理汇总了Java中org.apache.cassandra.streaming.StreamPlan类的典型用法代码示例。如果您正苦于以下问题:Java StreamPlan类的具体用法?Java StreamPlan怎么用?Java StreamPlan使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StreamPlan类属于org.apache.cassandra.streaming包,在下文中一共展示了StreamPlan类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: RangeStreamer
import org.apache.cassandra.streaming.StreamPlan; //导入依赖的package包/类
public RangeStreamer(TokenMetadata metadata,
Collection<Token> tokens,
InetAddress address,
String description,
boolean useStrictConsistency,
IEndpointSnitch snitch,
StreamStateStore stateStore)
{
this.metadata = metadata;
this.tokens = tokens;
this.address = address;
this.description = description;
this.streamPlan = new StreamPlan(description, true);
this.useStrictConsistency = useStrictConsistency;
this.snitch = snitch;
this.stateStore = stateStore;
streamPlan.listeners(this.stateStore);
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:19,代码来源:RangeStreamer.java
示例2: startSync
import org.apache.cassandra.streaming.StreamPlan; //导入依赖的package包/类
/**
* Starts sending/receiving our list of differences to/from the remote endpoint: creates a callback
* that will be called out of band once the streams complete.
*/
protected void startSync(List<Range<Token>> differences)
{
InetAddress local = FBUtilities.getBroadcastAddress();
// We can take anyone of the node as source or destination, however if one is localhost, we put at source to avoid a forwarding
InetAddress dst = r2.endpoint.equals(local) ? r1.endpoint : r2.endpoint;
InetAddress preferred = SystemKeyspace.getPreferredIP(dst);
String message = String.format("Performing streaming repair of %d ranges with %s", differences.size(), dst);
logger.info("[repair #{}] {}", desc.sessionId, message);
boolean isIncremental = false;
if (desc.parentSessionId != null)
{
ActiveRepairService.ParentRepairSession prs = ActiveRepairService.instance.getParentRepairSession(desc.parentSessionId);
isIncremental = prs.isIncremental;
}
Tracing.traceRepair(message);
new StreamPlan("Repair", repairedAt, 1, false, isIncremental).listeners(this)
.flushBeforeTransfer(true)
// request ranges from the remote node
.requestRanges(dst, preferred, desc.keyspace, differences, desc.columnFamily)
// send ranges to the remote node
.transferRanges(dst, preferred, desc.keyspace, differences, desc.columnFamily)
.execute();
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:29,代码来源:LocalSyncTask.java
示例3: run
import org.apache.cassandra.streaming.StreamPlan; //导入依赖的package包/类
public void run()
{
InetAddress dest = request.dst;
InetAddress preferred = SystemKeyspace.getPreferredIP(dest);
logger.info(String.format("[streaming task #%s] Performing streaming repair of %d ranges with %s", desc.sessionId, request.ranges.size(), request.dst));
boolean isIncremental = false;
if (desc.parentSessionId != null)
{
ActiveRepairService.ParentRepairSession prs = ActiveRepairService.instance.getParentRepairSession(desc.parentSessionId);
isIncremental = prs.isIncremental;
}
new StreamPlan("Repair", repairedAt, 1, false, isIncremental).listeners(this)
.flushBeforeTransfer(true)
// request ranges from the remote node
.requestRanges(dest, preferred, desc.keyspace, request.ranges, desc.columnFamily)
// send ranges to the remote node
.transferRanges(dest, preferred, desc.keyspace, request.ranges, desc.columnFamily)
.execute();
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:20,代码来源:StreamingRepairTask.java
示例4: RangeStreamer
import org.apache.cassandra.streaming.StreamPlan; //导入依赖的package包/类
public RangeStreamer(TokenMetadata metadata, Collection<Token> tokens, InetAddress address, String description)
{
this.metadata = metadata;
this.tokens = tokens;
this.address = address;
this.description = description;
this.streamPlan = new StreamPlan(description);
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:9,代码来源:RangeStreamer.java
示例5: streamHints
import org.apache.cassandra.streaming.StreamPlan; //导入依赖的package包/类
private Future<StreamState> streamHints()
{
// StreamPlan will not fail if there are zero files to transfer, so flush anyway (need to get any in-memory hints, as well)
ColumnFamilyStore hintsCF = Keyspace.open(Keyspace.SYSTEM_KS).getColumnFamilyStore(SystemKeyspace.HINTS_CF);
FBUtilities.waitOnFuture(hintsCF.forceFlush());
// gather all live nodes in the cluster that aren't also leaving
List<InetAddress> candidates = new ArrayList<>(StorageService.instance.getTokenMetadata().cloneAfterAllLeft().getAllEndpoints());
candidates.remove(FBUtilities.getBroadcastAddress());
for (Iterator<InetAddress> iter = candidates.iterator(); iter.hasNext(); )
{
InetAddress address = iter.next();
if (!FailureDetector.instance.isAlive(address))
iter.remove();
}
if (candidates.isEmpty())
{
logger.warn("Unable to stream hints since no live endpoints seen");
return Futures.immediateFuture(null);
}
else
{
// stream to the closest peer as chosen by the snitch
DatabaseDescriptor.getEndpointSnitch().sortByProximity(FBUtilities.getBroadcastAddress(), candidates);
InetAddress hintsDestinationHost = candidates.get(0);
InetAddress preferred = SystemKeyspace.getPreferredIP(hintsDestinationHost);
// stream all hints -- range list will be a singleton of "the entire ring"
Token token = StorageService.getPartitioner().getMinimumToken();
List<Range<Token>> ranges = Collections.singletonList(new Range<>(token, token));
return new StreamPlan("Hints").transferRanges(hintsDestinationHost,
preferred,
Keyspace.SYSTEM_KS,
ranges,
SystemKeyspace.HINTS_CF)
.execute();
}
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:41,代码来源:StorageService.java
示例6: RangeStreamer
import org.apache.cassandra.streaming.StreamPlan; //导入依赖的package包/类
public RangeStreamer(TokenMetadata metadata, InetAddress address, String description)
{
this.metadata = metadata;
this.address = address;
this.description = description;
this.streamPlan = new StreamPlan(description);
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:8,代码来源:RangeStreamer.java
示例7: streamLegacyTable
import org.apache.cassandra.streaming.StreamPlan; //导入依赖的package包/类
private void streamLegacyTable(String tablePattern, String legacyVersion, String compactNameSuffix) throws Exception
{
String table = String.format(tablePattern, legacyVersion, compactNameSuffix);
SSTableReader sstable = SSTableReader.open(getDescriptor(legacyVersion, table));
IPartitioner p = sstable.getPartitioner();
List<Range<Token>> ranges = new ArrayList<>();
ranges.add(new Range<>(p.getMinimumToken(), p.getToken(ByteBufferUtil.bytes("100"))));
ranges.add(new Range<>(p.getToken(ByteBufferUtil.bytes("100")), p.getMinimumToken()));
ArrayList<StreamSession.SSTableStreamingSections> details = new ArrayList<>();
details.add(new StreamSession.SSTableStreamingSections(sstable.ref(),
sstable.getPositionsForRanges(ranges),
sstable.estimatedKeysForRanges(ranges), sstable.getSSTableMetadata().repairedAt));
new StreamPlan("LegacyStreamingTest").transferFiles(FBUtilities.getBroadcastAddress(), details)
.execute().get();
}
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:16,代码来源:LegacySSTableTest.java
注:本文中的org.apache.cassandra.streaming.StreamPlan类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论