• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java CType类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.apache.cassandra.db.composites.CType的典型用法代码示例。如果您正苦于以下问题:Java CType类的具体用法?Java CType怎么用?Java CType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

CType类属于org.apache.cassandra.db.composites包,在下文中一共展示了CType类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: deserializeIndex

点赞 3

import org.apache.cassandra.db.composites.CType; //导入依赖的package包/类
/**
 * Deserialize the index into a structure and return it
 *
 * @param in input source
 * @param type the comparator type for the column family
 *
 * @return ArrayList<IndexInfo> - list of de-serialized indexes
 * @throws IOException if an I/O error occurs.
 */
public static List<IndexInfo> deserializeIndex(FileDataInput in, CType type) throws IOException
{
    int columnIndexSize = in.readInt();
    if (columnIndexSize == 0)
        return Collections.<IndexInfo>emptyList();
    ArrayList<IndexInfo> indexList = new ArrayList<IndexInfo>();
    FileMark mark = in.mark();
    ISerializer<IndexInfo> serializer = type.indexSerializer();
    while (in.bytesPastMark(mark) < columnIndexSize)
    {
        indexList.add(serializer.deserialize(in));
    }
    assert in.bytesPastMark(mark) == columnIndexSize;

    return indexList;
}
 

开发者ID:vcostet,
项目名称:cassandra-kmean,
代码行数:26,
代码来源:IndexHelper.java

示例2: validateComposite

点赞 2

import org.apache.cassandra.db.composites.CType; //导入依赖的package包/类
public static void validateComposite(Composite name, CType type) throws InvalidRequestException
{
    long serializedSize = type.serializer().serializedSize(name, TypeSizes.NATIVE);
    if (serializedSize > Cell.MAX_NAME_LENGTH)
        throw new InvalidRequestException(String.format("The sum of all clustering columns is too long (%s > %s)",
                                                        serializedSize,
                                                        Cell.MAX_NAME_LENGTH));
}
 

开发者ID:vcostet,
项目名称:cassandra-kmean,
代码行数:9,
代码来源:QueryProcessor.java

示例3: promotedSize

点赞 2

import org.apache.cassandra.db.composites.CType; //导入依赖的package包/类
@Override
public int promotedSize(CType type)
{
    TypeSizes typeSizes = TypeSizes.NATIVE;
    long size = DeletionTime.serializer.serializedSize(deletionTime, typeSizes);
    size += typeSizes.sizeof(columnsIndex.size()); // number of entries
    ISerializer<IndexHelper.IndexInfo> idxSerializer = type.indexSerializer();
    for (IndexHelper.IndexInfo info : columnsIndex)
        size += idxSerializer.serializedSize(info, typeSizes);

    return Ints.checkedCast(size);
}
 

开发者ID:vcostet,
项目名称:cassandra-kmean,
代码行数:13,
代码来源:RowIndexEntry.java

示例4: maySelectPrefix

点赞 2

import org.apache.cassandra.db.composites.CType; //导入依赖的package包/类
public boolean maySelectPrefix(CType type, Composite prefix)
{
    for (CellName column : columns)
    {
        if (prefix.isPrefixOf(type, column))
            return true;
    }
    return false;
}
 

开发者ID:vcostet,
项目名称:cassandra-kmean,
代码行数:10,
代码来源:NamesQueryFilter.java

示例5: maySelectPrefix

点赞 2

import org.apache.cassandra.db.composites.CType; //导入依赖的package包/类
public boolean maySelectPrefix(CType type, Composite prefix)
{
    for (ColumnSlice slice : slices)
        if (slice.includes(type, prefix))
            return true;
    return false;
}
 

开发者ID:vcostet,
项目名称:cassandra-kmean,
代码行数:8,
代码来源:SliceQueryFilter.java

示例6: indexFor

点赞 2

import org.apache.cassandra.db.composites.CType; //导入依赖的package包/类
/**
 * The index of the IndexInfo in which a scan starting with @name should begin.
 *
 * @param name
 *         name of the index
 *
 * @param indexList
 *          list of the indexInfo objects
 *
 * @param comparator
 *          comparator type
 *
 * @param reversed
 *          is name reversed
 *
 * @return int index
 */
public static int indexFor(Composite name, List<IndexInfo> indexList, CType comparator, boolean reversed, int lastIndex)
{
    if (name.isEmpty())
        return lastIndex >= 0 ? lastIndex : reversed ? indexList.size() - 1 : 0;

    if (lastIndex >= indexList.size())
        return -1;

    IndexInfo target = new IndexInfo(name, name, 0, 0);
    /*
    Take the example from the unit test, and say your index looks like this:
    [0..5][10..15][20..25]
    and you look for the slice [13..17].

    When doing forward slice, we we doing a binary search comparing 13 (the start of the query)
    to the lastName part of the index slot. You'll end up with the "first" slot, going from left to right,
    that may contain the start.

    When doing a reverse slice, we do the same thing, only using as a start column the end of the query,
    i.e. 17 in this example, compared to the firstName part of the index slots.  bsearch will give us the
    first slot where firstName > start ([20..25] here), so we subtract an extra one to get the slot just before.
    */
    int startIdx = 0;
    List<IndexInfo> toSearch = indexList;
    if (lastIndex >= 0)
    {
        if (reversed)
        {
            toSearch = indexList.subList(0, lastIndex + 1);
        }
        else
        {
            startIdx = lastIndex;
            toSearch = indexList.subList(lastIndex, indexList.size());
        }
    }
    int index = Collections.binarySearch(toSearch, target, getComparator(comparator, reversed));
    return startIdx + (index < 0 ? -index - (reversed ? 2 : 1) : index);
}
 

开发者ID:vcostet,
项目名称:cassandra-kmean,
代码行数:57,
代码来源:IndexHelper.java

示例7: indexFor

点赞 2

import org.apache.cassandra.db.composites.CType; //导入依赖的package包/类
/**
 * The index of the IndexInfo in which a scan starting with @name should begin.
 *
 * @param name
 *         name of the index
 *
 * @param indexList
 *          list of the indexInfo objects
 *
 * @param comparator
 *          comparator type
 *
 * @param reversed
 *          is name reversed
 *
 * @return int index
 */
public static int indexFor(Composite name, List<IndexInfo> indexList, CType comparator, boolean reversed, int lastIndex)
{
    if (name.isEmpty() && reversed)
        return indexList.size() - 1;

    if (lastIndex >= indexList.size())
        return -1;

    IndexInfo target = new IndexInfo(name, name, 0, 0);
    /*
    Take the example from the unit test, and say your index looks like this:
    [0..5][10..15][20..25]
    and you look for the slice [13..17].

    When doing forward slice, we we doing a binary search comparing 13 (the start of the query)
    to the lastName part of the index slot. You'll end up with the "first" slot, going from left to right,
    that may contain the start.

    When doing a reverse slice, we do the same thing, only using as a start column the end of the query,
    i.e. 17 in this example, compared to the firstName part of the index slots.  bsearch will give us the
    first slot where firstName > start ([20..25] here), so we subtract an extra one to get the slot just before.
    */
    int startIdx = 0;
    List<IndexInfo> toSearch = indexList;
    if (lastIndex >= 0)
    {
        if (reversed)
        {
            toSearch = indexList.subList(0, lastIndex + 1);
        }
        else
        {
            startIdx = lastIndex;
            toSearch = indexList.subList(lastIndex, indexList.size());
        }
    }
    int index = Collections.binarySearch(toSearch, target, getComparator(comparator, reversed));
    return startIdx + (index < 0 ? -index - (reversed ? 2 : 1) : index);
}
 

开发者ID:mafernandez-stratio,
项目名称:cassandra-cqlMod,
代码行数:57,
代码来源:IndexHelper.java

示例8: Serializer

点赞 2

import org.apache.cassandra.db.composites.CType; //导入依赖的package包/类
public Serializer(CType type)
{
    this.type = type;
}
 

开发者ID:vcostet,
项目名称:cassandra-kmean,
代码行数:5,
代码来源:RangeTombstone.java

示例9: Serializer

点赞 2

import org.apache.cassandra.db.composites.CType; //导入依赖的package包/类
public Serializer(CType type)
{
    this.rtlSerializer = new RangeTombstoneList.Serializer(type);
}
 

开发者ID:vcostet,
项目名称:cassandra-kmean,
代码行数:5,
代码来源:DeletionInfo.java

示例10: getComparator

点赞 2

import org.apache.cassandra.db.composites.CType; //导入依赖的package包/类
public static Comparator<IndexInfo> getComparator(final CType nameComparator, boolean reversed)
{
    return reversed ? nameComparator.indexReverseComparator() : nameComparator.indexComparator();
}
 

开发者ID:vcostet,
项目名称:cassandra-kmean,
代码行数:5,
代码来源:IndexHelper.java

示例11: getKeyValidatorAsCType

点赞 2

import org.apache.cassandra.db.composites.CType; //导入依赖的package包/类
public CType getKeyValidatorAsCType()
{
    return keyValidator instanceof CompositeType
         ? new CompoundCType(((CompositeType) keyValidator).types)
         : new SimpleCType(keyValidator);
}
 

开发者ID:daidong,
项目名称:GraphTrek,
代码行数:7,
代码来源:CFMetaData.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)