本文整理汇总了Java中org.apache.cassandra.db.RowPosition类的典型用法代码示例。如果您正苦于以下问题:Java RowPosition类的具体用法?Java RowPosition怎么用?Java RowPosition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RowPosition类属于org.apache.cassandra.db包,在下文中一共展示了RowPosition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: serialize
import org.apache.cassandra.db.RowPosition; //导入依赖的package包/类
public void serialize(AbstractBounds<?> range, DataOutputPlus out, int version) throws IOException
{
/*
* The first int tells us if it's a range or bounds (depending on the value) _and_ if it's tokens or keys (depending on the
* sign). We use negative kind for keys so as to preserve the serialization of token from older version.
*/
out.writeInt(kindInt(range));
if (range.left instanceof Token)
{
Token.serializer.serialize((Token) range.left, out);
Token.serializer.serialize((Token) range.right, out);
}
else
{
RowPosition.serializer.serialize((RowPosition) range.left, out);
RowPosition.serializer.serialize((RowPosition) range.right, out);
}
}
示例2: deserialize
import org.apache.cassandra.db.RowPosition; //导入依赖的package包/类
public AbstractBounds<?> deserialize(DataInput in, int version) throws IOException
{
int kind = in.readInt();
boolean isToken = kind >= 0;
if (!isToken)
kind = -(kind+1);
RingPosition<?> left, right;
if (isToken)
{
left = Token.serializer.deserialize(in);
right = Token.serializer.deserialize(in);
}
else
{
left = RowPosition.serializer.deserialize(in);
right = RowPosition.serializer.deserialize(in);
}
if (kind == Type.RANGE.ordinal())
return new Range(left, right);
return new Bounds(left, right);
}
示例3: LeveledManifest
import org.apache.cassandra.db.RowPosition; //导入依赖的package包/类
LeveledManifest(ColumnFamilyStore cfs, int maxSSTableSizeInMB, SizeTieredCompactionStrategyOptions options)
{
this.cfs = cfs;
this.maxSSTableSizeInBytes = maxSSTableSizeInMB * 1024 * 1024;
this.options = options;
// allocate enough generations for a PB of data, with a 1-MB sstable size. (Note that if maxSSTableSize is
// updated, we will still have sstables of the older, potentially smaller size. So don't make this
// dependent on maxSSTableSize.)
int n = (int) Math.log10(1000 * 1000 * 1000);
generations = new List[n];
lastCompactedKeys = new RowPosition[n];
for (int i = 0; i < generations.length; i++)
{
generations[i] = new ArrayList<>();
lastCompactedKeys[i] = cfs.partitioner.getMinimumToken().minKeyBound();
}
compactionCounter = new int[n];
}
示例4: binarySearch
import org.apache.cassandra.db.RowPosition; //导入依赖的package包/类
public int binarySearch(RowPosition key)
{
int low = 0, mid = offsetCount, high = mid - 1, result = -1;
while (low <= high)
{
mid = (low + high) >> 1;
result = -DecoratedKey.compareTo(partitioner, ByteBuffer.wrap(getKey(mid)), key);
if (result > 0)
{
low = mid + 1;
}
else if (result == 0)
{
return mid;
}
else
{
high = mid - 1;
}
}
return -mid - (result < 0 ? 1 : 2);
}
示例5: testNormalizeComplex
import org.apache.cassandra.db.RowPosition; //导入依赖的package包/类
@Test
public void testNormalizeComplex()
{
List<Range<RowPosition>> input, expected;
input = asList(range("8", "2"), range("7", "9"), range("4", "5"));
expected = asList(range("", "2"), range("4", "5"), range("7", ""));
assertNormalize(input, expected);
input = asList(range("5", "9"), range("2", "5"));
expected = asList(range("2", "9"));
assertNormalize(input, expected);
input = asList(range ("", "1"), range("9", "2"), range("4", "5"), range("", ""));
expected = asList(range("", ""));
assertNormalize(input, expected);
input = asList(range ("", "1"), range("1", "4"), range("4", "5"), range("5", ""));
expected = asList(range("", ""));
assertNormalize(input, expected);
}
示例6: serialize
import org.apache.cassandra.db.RowPosition; //导入依赖的package包/类
public void serialize(AbstractBounds<?> range, DataOutput out, int version) throws IOException
{
/*
* The first int tells us if it's a range or bounds (depending on the value) _and_ if it's tokens or keys (depending on the
* sign). We use negative kind for keys so as to preserve the serialization of token from older version.
*/
out.writeInt(kindInt(range));
if (range.left instanceof Token)
{
Token.serializer.serialize((Token) range.left, out);
Token.serializer.serialize((Token) range.right, out);
}
else
{
RowPosition.serializer.serialize((RowPosition) range.left, out);
RowPosition.serializer.serialize((RowPosition) range.right, out);
}
}
示例7: deserialize
import org.apache.cassandra.db.RowPosition; //导入依赖的package包/类
public AbstractBounds<?> deserialize(DataInput in, int version) throws IOException
{
int kind = in.readInt();
boolean isToken = kind >= 0;
if (!isToken)
kind = -(kind+1);
RingPosition left, right;
if (isToken)
{
left = Token.serializer.deserialize(in);
right = Token.serializer.deserialize(in);
}
else
{
left = RowPosition.serializer.deserialize(in);
right = RowPosition.serializer.deserialize(in);
}
if (kind == Type.RANGE.ordinal())
return new Range(left, right);
return new Bounds(left, right);
}
示例8: LeveledManifest
import org.apache.cassandra.db.RowPosition; //导入依赖的package包/类
private LeveledManifest(ColumnFamilyStore cfs, int maxSSTableSizeInMB, SizeTieredCompactionStrategyOptions options)
{
this.cfs = cfs;
this.maxSSTableSizeInBytes = maxSSTableSizeInMB * 1024 * 1024;
this.options = options;
// allocate enough generations for a PB of data, with a 1-MB sstable size. (Note that if maxSSTableSize is
// updated, we will still have sstables of the older, potentially smaller size. So don't make this
// dependent on maxSSTableSize.)
int n = (int) Math.log10(1000 * 1000 * 1000);
generations = new List[n];
lastCompactedKeys = new RowPosition[n];
for (int i = 0; i < generations.length; i++)
{
generations[i] = new ArrayList<SSTableReader>();
lastCompactedKeys[i] = cfs.partitioner.getMinimumToken().minKeyBound();
}
}
示例9: binarySearch
import org.apache.cassandra.db.RowPosition; //导入依赖的package包/类
public int binarySearch(RowPosition key)
{
int low = 0, mid = summary_size, high = mid - 1, result = -1;
while (low <= high)
{
mid = (low + high) >> 1;
result = -DecoratedKey.compareTo(partitioner, ByteBuffer.wrap(getKey(mid)), key);
if (result > 0)
{
low = mid + 1;
}
else if (result == 0)
{
return mid;
}
else
{
high = mid - 1;
}
}
return -mid - (result < 0 ? 1 : 2);
}
示例10: LeveledManifest
import org.apache.cassandra.db.RowPosition; //导入依赖的package包/类
private LeveledManifest(ColumnFamilyStore cfs, int maxSSTableSizeInMB, SizeTieredCompactionStrategyOptions options)
{
this.cfs = cfs;
this.hasRepairedData = cfs.getRepairedSSTables().size() > 0;
this.maxSSTableSizeInBytes = maxSSTableSizeInMB * 1024 * 1024;
this.options = options;
// allocate enough generations for a PB of data, with a 1-MB sstable size. (Note that if maxSSTableSize is
// updated, we will still have sstables of the older, potentially smaller size. So don't make this
// dependent on maxSSTableSize.)
int n = (int) Math.log10(1000 * 1000 * 1000);
generations = new List[n];
lastCompactedKeys = new RowPosition[n];
for (int i = 0; i < generations.length; i++)
{
generations[i] = new ArrayList<>();
lastCompactedKeys[i] = cfs.partitioner.getMinimumToken().minKeyBound();
}
unrepairedL0 = new ArrayList<>();
}
示例11: LeveledManifest
import org.apache.cassandra.db.RowPosition; //导入依赖的package包/类
private LeveledManifest(ColumnFamilyStore cfs, int maxSSTableSizeInMB)
{
this.cfs = cfs;
this.maxSSTableSizeInBytes = maxSSTableSizeInMB * 1024 * 1024;
// allocate enough generations for a PB of data, with a 1-MB sstable size. (Note that if maxSSTableSize is
// updated, we will still have sstables of the older, potentially smaller size. So don't make this
// dependent on maxSSTableSize.)
int n = (int) Math.log10(1000 * 1000 * 1000);
generations = new List[n];
lastCompactedKeys = new RowPosition[n];
for (int i = 0; i < generations.length; i++)
{
generations[i] = new ArrayList<SSTableReader>();
lastCompactedKeys[i] = cfs.partitioner.getMinimumToken().minKeyBound();
}
sstableGenerations = new HashMap<SSTableReader, Integer>();
}
示例12: binarySearch
import org.apache.cassandra.db.RowPosition; //导入依赖的package包/类
public int binarySearch(RowPosition key)
{
int low = 0, mid = keys.length, high = mid - 1, result = -1;
while (low <= high)
{
mid = (low + high) >> 1;
result = -partitioner.decorateKey(ByteBuffer.wrap(keys[mid])).compareTo(key);
if (result > 0)
{
low = mid + 1;
}
else if (result == 0)
{
return mid;
}
else
{
high = mid - 1;
}
}
return -mid - (result < 0 ? 1 : 2);
}
示例13: binarySearch
import org.apache.cassandra.db.RowPosition; //导入依赖的package包/类
public int binarySearch(RowPosition key)
{
int low = 0, mid = summarySize, high = mid - 1, result = -1;
while (low <= high)
{
mid = (low + high) >> 1;
result = -DecoratedKey.compareTo(partitioner, ByteBuffer.wrap(getKey(mid)), key);
if (result > 0)
{
low = mid + 1;
}
else if (result == 0)
{
return mid;
}
else
{
high = mid - 1;
}
}
return -mid - (result < 0 ? 1 : 2);
}
示例14: serializedSize
import org.apache.cassandra.db.RowPosition; //导入依赖的package包/类
public long serializedSize(AbstractBounds<?> ab, int version)
{
int size = TypeSizes.NATIVE.sizeof(kindInt(ab));
if (ab.left instanceof Token)
{
size += Token.serializer.serializedSize((Token) ab.left, TypeSizes.NATIVE);
size += Token.serializer.serializedSize((Token) ab.right, TypeSizes.NATIVE);
}
else
{
size += RowPosition.serializer.serializedSize((RowPosition) ab.left, TypeSizes.NATIVE);
size += RowPosition.serializer.serializedSize((RowPosition) ab.right, TypeSizes.NATIVE);
}
return size;
}
示例15: compareTo
import org.apache.cassandra.db.RowPosition; //导入依赖的package包/类
public int compareTo(RowPosition pos)
{
if (this == pos)
return 0;
int cmp = getToken().compareTo(pos.getToken());
if (cmp != 0)
return cmp;
if (isMinimumBound)
return ((pos instanceof KeyBound) && ((KeyBound)pos).isMinimumBound) ? 0 : -1;
else
return ((pos instanceof KeyBound) && !((KeyBound)pos).isMinimumBound) ? 0 : 1;
}