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


Java VertexIDAssigner类代码示例

本文整理汇总了Java中com.thinkaurelius.titan.graphdb.database.idassigner.VertexIDAssigner的典型用法代码示例。如果您正苦于以下问题:Java VertexIDAssigner类的具体用法?Java VertexIDAssigner怎么用?Java VertexIDAssigner使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


VertexIDAssigner类属于com.thinkaurelius.titan.graphdb.database.idassigner包,在下文中一共展示了VertexIDAssigner类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testKeybasedGraphPartitioning

import com.thinkaurelius.titan.graphdb.database.idassigner.VertexIDAssigner; //导入依赖的package包/类
@Test
public void testKeybasedGraphPartitioning() {
    Object[] options = {option(GraphDatabaseConfiguration.IDS_FLUSH), false,
                        option(VertexIDAssigner.PLACEMENT_STRATEGY), PropertyPlacementStrategy.class.getName(),
            option(PropertyPlacementStrategy.PARTITION_KEY), "clusterId"};
    clopen(options);

    int[] groupDegrees = {5,5,5,5,5,5,5,5};
    int numVertices = setupGroupClusters(groupDegrees,CommitMode.PER_VERTEX);

    IntSet partitionIds = new IntHashSet(numVertices); //to track the "spread" of partition ids
    for (int i=0;i<groupDegrees.length;i++) {
        TitanVertex g = getOnlyVertex(tx.query().has("groupid","group"+i));
        int partitionId = -1;
        for (TitanVertex v : g.query().direction(Direction.IN).labels("member").vertices()) {
            if (partitionId<0) partitionId = getPartitionID(v);
            assertEquals(partitionId,getPartitionID(v));
            partitionIds.add(partitionId);
        }
    }
    assertTrue(partitionIds.size()>numPartitions/2); //This is a probabilistic test that might fail
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:23,代码来源:TitanPartitionGraphTest.java

示例2: VertexIDAssignerTest

import com.thinkaurelius.titan.graphdb.database.idassigner.VertexIDAssigner; //导入依赖的package包/类
/**
 *
 * @param numPartitionsBits The number of partitions bits to use. This means there are exactly (1<<numPartitionBits) partitions.
 * @param partitionMax The maxium number of ids that can be allocated per partition. This is artifically constraint by the MockIDAuthority
 * @param localPartitionDef This array contains three integers: 1+2) lower and upper bounds for the local partition range, and
 *                          3) the bit width of the local bounds. The bounds will be bitshifted forward to consume the bit width
 */
public VertexIDAssignerTest(int numPartitionsBits, int partitionMax, int[] localPartitionDef) {
    MockIDAuthority idAuthority = new MockIDAuthority(11, partitionMax);

    StandardStoreFeatures.Builder fb = new StandardStoreFeatures.Builder();

    if (null != localPartitionDef) {
        fb.localKeyPartition(true);
        idAuthority.setLocalPartition(PartitionIDRangeTest.convert(localPartitionDef[0],localPartitionDef[1],localPartitionDef[2]));
    }
    StoreFeatures features = fb.build();

    ModifiableConfiguration config = GraphDatabaseConfiguration.buildGraphConfiguration();
    config.set(GraphDatabaseConfiguration.CLUSTER_MAX_PARTITIONS,1<<numPartitionsBits);
    idAssigner = new VertexIDAssigner(config, idAuthority, features);
    System.out.println(String.format("Configuration [%s|%s|%s]",numPartitionsBits,partitionMax,Arrays.toString(localPartitionDef)));

    if (localPartitionDef!=null && localPartitionDef[0]<localPartitionDef[1] && localPartitionDef[2]<=numPartitionsBits) {
        this.maxIDAssignments = ((localPartitionDef[1]-localPartitionDef[0])<<(numPartitionsBits-localPartitionDef[2]))*((long)partitionMax);
    } else {
        this.maxIDAssignments = (1<<numPartitionsBits)*((long)partitionMax);
    }
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:30,代码来源:VertexIDAssignerTest.java

示例3: VertexIDAssignerTest

import com.thinkaurelius.titan.graphdb.database.idassigner.VertexIDAssigner; //导入依赖的package包/类
public VertexIDAssignerTest(Boolean partition, int partitionMax, int[] localPartition) {
    MockIDAuthority idAuthority = new MockIDAuthority(11, partitionMax);

    StandardStoreFeatures.Builder fb = new StandardStoreFeatures.Builder();

    if (null != localPartition) {
        fb.localKeyPartition(true);
        idAuthority.setLocalPartition(localPartition);
    }
    StoreFeatures features = fb.build();

    ModifiableConfiguration config = GraphDatabaseConfiguration.buildConfiguration();
    config.set(GraphDatabaseConfiguration.CLUSTER_PARTITION,partition);
    config.set(GraphDatabaseConfiguration.CLUSTER_MAX_PARTITIONS,1024);
    idAssigner = new VertexIDAssigner(config, idAuthority, features);
    System.out.println("Partition: " + partition);
    System.out.println("partitionMax: " + partitionMax);
    System.out.println("localPartition: " + Arrays.toString(localPartition));
}
 
开发者ID:graben1437,项目名称:titan0.5.4-hbase1.1.1-custom,代码行数:20,代码来源:VertexIDAssignerTest.java

示例4: getIDAssigner

import com.thinkaurelius.titan.graphdb.database.idassigner.VertexIDAssigner; //导入依赖的package包/类
public VertexIDAssigner getIDAssigner(Backend backend) {
    return new VertexIDAssigner(configuration, backend.getIDAuthority(), backend.getStoreFeatures());
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:4,代码来源:GraphDatabaseConfiguration.java


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