本文整理汇总了Java中org.apache.cassandra.db.RowPosition类的典型用法代码示例。如果您正苦于以下问题:Java RowPosition类的具体用法?Java RowPosition怎么用?Java RowPosition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RowPosition类属于org.apache.cassandra.db包,在下文中一共展示了RowPosition类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:19,代码来源:AbstractBounds.java
示例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);
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:24,代码来源:AbstractBounds.java
示例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];
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:20,代码来源:LeveledManifest.java
示例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);
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:24,代码来源:IndexSummary.java
示例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);
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:22,代码来源:RangeTest.java
示例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);
}
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:19,代码来源:AbstractBounds.java
示例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);
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:24,代码来源:AbstractBounds.java
示例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();
}
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:19,代码来源:LeveledManifest.java
示例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);
}
开发者ID:pgaref,项目名称:ACaZoo,代码行数:24,代码来源:IndexSummary.java
示例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<>();
}
开发者ID:rajath26,项目名称:cassandra-trunk,代码行数:21,代码来源:LeveledManifest.java
示例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>();
}
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:19,代码来源:LeveledManifest.java
示例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);
}
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:26,代码来源:IndexSummary.java
示例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);
}
开发者ID:mafernandez-stratio,项目名称:cassandra-cqlMod,代码行数:24,代码来源:IndexSummary.java
示例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;
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:16,代码来源:AbstractBounds.java
示例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;
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:15,代码来源:Token.java
示例16: getSSTableSectionsForRanges
import org.apache.cassandra.db.RowPosition; //导入依赖的package包/类
private List<SSTableStreamingSections> getSSTableSectionsForRanges(Collection<Range<Token>> ranges, Collection<ColumnFamilyStore> stores, long overriddenRepairedAt, boolean isIncremental)
{
Refs<SSTableReader> refs = new Refs<>();
try
{
for (ColumnFamilyStore cfStore : stores)
{
List<AbstractBounds<RowPosition>> rowBoundsList = new ArrayList<>(ranges.size());
for (Range<Token> range : ranges)
rowBoundsList.add(range.toRowBounds());
refs.addAll(cfStore.selectAndReference(cfStore.viewFilter(rowBoundsList, !isIncremental)).refs);
}
List<SSTableStreamingSections> sections = new ArrayList<>(refs.size());
for (SSTableReader sstable : refs)
{
long repairedAt = overriddenRepairedAt;
if (overriddenRepairedAt == ActiveRepairService.UNREPAIRED_SSTABLE)
repairedAt = sstable.getSSTableMetadata().repairedAt;
sections.add(new SSTableStreamingSections(sstable, refs.get(sstable),
sstable.getPositionsForRanges(ranges),
sstable.estimatedKeysForRanges(ranges),
repairedAt));
}
return sections;
}
catch (Throwable t)
{
refs.release();
throw t;
}
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:33,代码来源:StreamSession.java
示例17: getIndexScanPosition
import org.apache.cassandra.db.RowPosition; //导入依赖的package包/类
/**
* Gets the position in the index file to start scanning to find the given key (at most indexInterval keys away,
* modulo downsampling of the index summary). Always returns a value >= 0
*/
public long getIndexScanPosition(RowPosition key)
{
if (openReason == OpenReason.MOVED_START && key.compareTo(first) < 0)
key = first;
return getIndexScanPositionFromBinarySearchResult(indexSummary.binarySearch(key), indexSummary);
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:12,代码来源:SSTableReader.java
示例18: firstKeyBeyond
import org.apache.cassandra.db.RowPosition; //导入依赖的package包/类
/**
* Finds and returns the first key beyond a given token in this SSTable or null if no such key exists.
*/
public DecoratedKey firstKeyBeyond(RowPosition token)
{
if (token.compareTo(first) < 0)
return first;
long sampledPosition = getIndexScanPosition(token);
Iterator<FileDataInput> segments = ifile.iterator(sampledPosition);
while (segments.hasNext())
{
FileDataInput in = segments.next();
try
{
while (!in.isEOF())
{
ByteBuffer indexKey = ByteBufferUtil.readWithShortLength(in);
DecoratedKey indexDecoratedKey = partitioner.decorateKey(indexKey);
if (indexDecoratedKey.compareTo(token) > 0)
return indexDecoratedKey;
RowIndexEntry.Serializer.skip(in);
}
}
catch (IOException e)
{
markSuspect();
throw new CorruptSSTableException(e, in.getPath());
}
finally
{
FileUtils.closeQuietly(in);
}
}
return null;
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:40,代码来源:SSTableReader.java
示例19: addRange
import org.apache.cassandra.db.RowPosition; //导入依赖的package包/类
private void addRange(AbstractBounds<RowPosition> requested, List<AbstractBounds<RowPosition>> boundsList)
{
if (requested instanceof Range && ((Range)requested).isWrapAround())
{
if (requested.right.compareTo(sstable.first) >= 0)
{
// since we wrap, we must contain the whole sstable prior to stopKey()
Boundary<RowPosition> left = new Boundary<RowPosition>(sstable.first, true);
Boundary<RowPosition> right;
right = requested.rightBoundary();
right = minRight(right, sstable.last, true);
if (!isEmpty(left, right))
boundsList.add(AbstractBounds.bounds(left, right));
}
if (requested.left.compareTo(sstable.last) <= 0)
{
// since we wrap, we must contain the whole sstable after dataRange.startKey()
Boundary<RowPosition> right = new Boundary<RowPosition>(sstable.last, true);
Boundary<RowPosition> left;
left = requested.leftBoundary();
left = maxLeft(left, sstable.first, true);
if (!isEmpty(left, right))
boundsList.add(AbstractBounds.bounds(left, right));
}
}
else
{
assert requested.left.compareTo(requested.right) <= 0 || requested.right.isMinimum();
Boundary<RowPosition> left, right;
left = requested.leftBoundary();
right = requested.rightBoundary();
left = maxLeft(left, sstable.first, true);
// apparently isWrapAround() doesn't count Bounds that extend to the limit (min) as wrapping
right = requested.right.isMinimum() ? new Boundary<RowPosition>(sstable.last, true)
: minRight(right, sstable.last, true);
if (!isEmpty(left, right))
boundsList.add(AbstractBounds.bounds(left, right));
}
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:40,代码来源:SSTableScanner.java
示例20: testNormalizeNoop
import org.apache.cassandra.db.RowPosition; //导入依赖的package包/类
@Test
public void testNormalizeNoop()
{
List<Range<RowPosition>> l;
l = asList(range("1", "3"), range("4", "5"));
assertNormalize(l, l);
}
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:9,代码来源:RangeTest.java
注:本文中的org.apache.cassandra.db.RowPosition类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论