Search in sources :

Example 6 with KeyRange

use of org.janusgraph.diskstorage.keycolumnvalue.KeyRange in project janusgraph by JanusGraph.

the class CassandraHelperTest method testTransformRangeWithRollingCarry.

@Test
public void testTransformRangeWithRollingCarry() {
    BytesToken token2 = new BytesToken(new byte[] { 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 });
    KeyRange keyRange = CassandraHelper.transformRange(ZERO, token2);
    Assert.assertArrayEquals(new byte[] { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, keyRange.getEnd().asByteBuffer().array());
}
Also used : KeyRange(org.janusgraph.diskstorage.keycolumnvalue.KeyRange) BytesToken(org.apache.cassandra.dht.BytesToken) Test(org.junit.Test)

Example 7 with KeyRange

use of org.janusgraph.diskstorage.keycolumnvalue.KeyRange in project janusgraph by JanusGraph.

the class CassandraHelperTest method testTransformRange.

@Test
public void testTransformRange() {
    BytesToken token2 = new BytesToken(new byte[] { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1 });
    KeyRange keyRange = CassandraHelper.transformRange(ZERO, token2);
    Assert.assertArrayEquals(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }, keyRange.getStart().asByteBuffer().array());
    Assert.assertArrayEquals(new byte[] { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 0 }, keyRange.getEnd().asByteBuffer().array());
}
Also used : KeyRange(org.janusgraph.diskstorage.keycolumnvalue.KeyRange) BytesToken(org.apache.cassandra.dht.BytesToken) Test(org.junit.Test)

Aggregations

KeyRange (org.janusgraph.diskstorage.keycolumnvalue.KeyRange)7 StaticBuffer (org.janusgraph.diskstorage.StaticBuffer)4 BytesToken (org.apache.cassandra.dht.BytesToken)3 Test (org.junit.Test)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 ArrayList (java.util.ArrayList)1 AbstractByteOrderedPartitioner (org.apache.cassandra.dht.AbstractByteOrderedPartitioner)1 IPartitioner (org.apache.cassandra.dht.IPartitioner)1 Token (org.apache.cassandra.dht.Token)1 HRegionInfo (org.apache.hadoop.hbase.HRegionInfo)1 HRegionLocation (org.apache.hadoop.hbase.HRegionLocation)1 ServerName (org.apache.hadoop.hbase.ServerName)1 TException (org.apache.thrift.TException)1 BackendException (org.janusgraph.diskstorage.BackendException)1 CTConnection (org.janusgraph.diskstorage.cassandra.thrift.thriftpool.CTConnection)1