当前位置: 首页>>代码示例>>Java>>正文


Java KSMetaData.optsWithRF方法代码示例

本文整理汇总了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]));
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:24,代码来源:OldNetworkTopologyStrategyTest.java

示例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]));
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:25,代码来源:OldNetworkTopologyStrategyTest.java

示例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]));
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:26,代码来源:OldNetworkTopologyStrategyTest.java

示例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;
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:19,代码来源:OldNetworkTopologyStrategyTest.java

示例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;
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:19,代码来源:OldNetworkTopologyStrategyTest.java


注:本文中的org.apache.cassandra.config.KSMetaData.optsWithRF方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。