本文整理汇总了Java中org.apache.cassandra.config.KSMetaData.optsWithRF方法的典型用法代码示例。如果您正苦于以下问题:Java KSMetaData.optsWithRF方法的具体用法?Java KSMetaData.optsWithRF怎么用?Java KSMetaData.optsWithRF使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cassandra.config.KSMetaData
的用法示例。
在下文中一共展示了KSMetaData.optsWithRF方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testBigIntegerEndpointsA
import org.apache.cassandra.config.KSMetaData; //导入方法依赖的package包/类
/**
* 4 same rack endpoints
*
* @throws UnknownHostException
*/
@Test
public void testBigIntegerEndpointsA() throws UnknownHostException
{
RackInferringSnitch endpointSnitch = new RackInferringSnitch();
AbstractReplicationStrategy strategy = new OldNetworkTopologyStrategy("Keyspace1", tmd, endpointSnitch, KSMetaData.optsWithRF(1));
addEndpoint("0", "5", "254.0.0.1");
addEndpoint("10", "15", "254.0.0.2");
addEndpoint("20", "25", "254.0.0.3");
addEndpoint("30", "35", "254.0.0.4");
expectedResults.put("5", buildResult("254.0.0.2", "254.0.0.3", "254.0.0.4"));
expectedResults.put("15", buildResult("254.0.0.3", "254.0.0.4", "254.0.0.1"));
expectedResults.put("25", buildResult("254.0.0.4", "254.0.0.1", "254.0.0.2"));
expectedResults.put("35", buildResult("254.0.0.1", "254.0.0.2", "254.0.0.3"));
testGetEndpoints(strategy, keyTokens.toArray(new Token[0]));
}
示例2: testBigIntegerEndpointsB
import org.apache.cassandra.config.KSMetaData; //导入方法依赖的package包/类
/**
* 3 same rack endpoints
* 1 external datacenter
*
* @throws UnknownHostException
*/
@Test
public void testBigIntegerEndpointsB() throws UnknownHostException
{
RackInferringSnitch endpointSnitch = new RackInferringSnitch();
AbstractReplicationStrategy strategy = new OldNetworkTopologyStrategy("Keyspace1", tmd, endpointSnitch, KSMetaData.optsWithRF(1));
addEndpoint("0", "5", "254.0.0.1");
addEndpoint("10", "15", "254.0.0.2");
addEndpoint("20", "25", "254.1.0.3");
addEndpoint("30", "35", "254.0.0.4");
expectedResults.put("5", buildResult("254.0.0.2", "254.1.0.3", "254.0.0.4"));
expectedResults.put("15", buildResult("254.1.0.3", "254.0.0.4", "254.0.0.1"));
expectedResults.put("25", buildResult("254.0.0.4", "254.1.0.3", "254.0.0.1"));
expectedResults.put("35", buildResult("254.0.0.1", "254.1.0.3", "254.0.0.2"));
testGetEndpoints(strategy, keyTokens.toArray(new Token[0]));
}
示例3: testBigIntegerEndpointsC
import org.apache.cassandra.config.KSMetaData; //导入方法依赖的package包/类
/**
* 2 same rack endpoints
* 1 same datacenter, different rack endpoints
* 1 external datacenter
*
* @throws UnknownHostException
*/
@Test
public void testBigIntegerEndpointsC() throws UnknownHostException
{
RackInferringSnitch endpointSnitch = new RackInferringSnitch();
AbstractReplicationStrategy strategy = new OldNetworkTopologyStrategy("Keyspace1", tmd, endpointSnitch, KSMetaData.optsWithRF(1));
addEndpoint("0", "5", "254.0.0.1");
addEndpoint("10", "15", "254.0.0.2");
addEndpoint("20", "25", "254.0.1.3");
addEndpoint("30", "35", "254.1.0.4");
expectedResults.put("5", buildResult("254.0.0.2", "254.0.1.3", "254.1.0.4"));
expectedResults.put("15", buildResult("254.0.1.3", "254.1.0.4", "254.0.0.1"));
expectedResults.put("25", buildResult("254.1.0.4", "254.0.0.1", "254.0.0.2"));
expectedResults.put("35", buildResult("254.0.0.1", "254.0.1.3", "254.1.0.4"));
testGetEndpoints(strategy, keyTokens.toArray(new Token[0]));
}
示例4: calculateStreamAndFetchRanges
import org.apache.cassandra.config.KSMetaData; //导入方法依赖的package包/类
private Pair<Set<Range<Token>>, Set<Range<Token>>> calculateStreamAndFetchRanges(BigIntegerToken[] tokens, BigIntegerToken[] tokensAfterMove, int movingNodeIdx) throws UnknownHostException
{
RackInferringSnitch endpointSnitch = new RackInferringSnitch();
InetAddress movingNode = InetAddress.getByName("254.0.0." + Integer.toString(movingNodeIdx + 1));
TokenMetadata tokenMetadataCurrent = initTokenMetadata(tokens);
TokenMetadata tokenMetadataAfterMove = initTokenMetadata(tokensAfterMove);
AbstractReplicationStrategy strategy = new OldNetworkTopologyStrategy("Keyspace1", tokenMetadataCurrent, endpointSnitch, KSMetaData.optsWithRF(2));
Collection<Range<Token>> currentRanges = strategy.getAddressRanges().get(movingNode);
Collection<Range<Token>> updatedRanges = strategy.getPendingAddressRanges(tokenMetadataAfterMove, tokensAfterMove[movingNodeIdx], movingNode);
Pair<Set<Range<Token>>, Set<Range<Token>>> ranges = StorageService.instance.calculateStreamAndFetchRanges(currentRanges, updatedRanges);
return ranges;
}
示例5: calculateStreamAndFetchRanges
import org.apache.cassandra.config.KSMetaData; //导入方法依赖的package包/类
private Pair<Set<Range<Token>>, Set<Range<Token>>> calculateStreamAndFetchRanges(BigIntegerToken[] tokens, BigIntegerToken[] tokensAfterMove, int movingNodeIdx, BigIntegerToken newToken) throws UnknownHostException
{
RackInferringSnitch endpointSnitch = new RackInferringSnitch();
InetAddress movingNode = InetAddress.getByName("254.0.0." + Integer.toString(movingNodeIdx + 1));
TokenMetadata tokenMetadataCurrent = initTokenMetadata(tokens);
TokenMetadata tokenMetadataAfterMove = initTokenMetadata(tokensAfterMove);
AbstractReplicationStrategy strategy = new OldNetworkTopologyStrategy("Keyspace1", tokenMetadataCurrent, endpointSnitch, KSMetaData.optsWithRF(2));
Collection<Range<Token>> currentRanges = strategy.getAddressRanges().get(movingNode);
Collection<Range<Token>> updatedRanges = strategy.getPendingAddressRanges(tokenMetadataAfterMove, tokensAfterMove[movingNodeIdx], movingNode);
Pair<Set<Range<Token>>, Set<Range<Token>>> ranges = StorageService.instance.calculateStreamAndFetchRanges(currentRanges, updatedRanges);
return ranges;
}