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


Java RowPosition类代码示例

本文整理汇总了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);
    }
}
 
开发者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


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