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


Java ConsistencyLevel.SERIAL属性代码示例

本文整理汇总了Java中org.apache.cassandra.db.ConsistencyLevel.SERIAL属性的典型用法代码示例。如果您正苦于以下问题:Java ConsistencyLevel.SERIAL属性的具体用法?Java ConsistencyLevel.SERIAL怎么用?Java ConsistencyLevel.SERIAL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.cassandra.db.ConsistencyLevel的用法示例。


在下文中一共展示了ConsistencyLevel.SERIAL属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: gatherFlags

private EnumSet<Flag> gatherFlags(QueryOptions options)
{
    EnumSet<Flag> flags = EnumSet.noneOf(Flag.class);
    if (options.getValues().size() > 0)
        flags.add(Flag.VALUES);
    if (options.skipMetadata())
        flags.add(Flag.SKIP_METADATA);
    if (options.getPageSize() >= 0)
        flags.add(Flag.PAGE_SIZE);
    if (options.getPagingState() != null)
        flags.add(Flag.PAGING_STATE);
    if (options.getSerialConsistency() != ConsistencyLevel.SERIAL)
        flags.add(Flag.SERIAL_CONSISTENCY);
    if (options.getSpecificOptions().timestamp != Long.MIN_VALUE)
        flags.add(Flag.TIMESTAMP);
    return flags;
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:17,代码来源:QueryOptions.java

示例2: SpecificOptions

private SpecificOptions(int pageSize, PagingState state, ConsistencyLevel serialConsistency, long timestamp)
{
    this.pageSize = pageSize;
    this.state = state;
    this.serialConsistency = serialConsistency == null ? ConsistencyLevel.SERIAL : serialConsistency;
    this.timestamp = timestamp;
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:7,代码来源:QueryOptions.java

示例3: gatherFlags

private EnumSet<Flag> gatherFlags(QueryOptions options)
{
    EnumSet<Flag> flags = EnumSet.noneOf(Flag.class);
    if (options.getValues().size() > 0)
        flags.add(Flag.VALUES);
    if (options.skipMetadata)
        flags.add(Flag.SKIP_METADATA);
    if (options.getPageSize() >= 0)
        flags.add(Flag.PAGE_SIZE);
    if (options.getPagingState() != null)
        flags.add(Flag.PAGING_STATE);
    if (options.getSerialConsistency() != ConsistencyLevel.SERIAL)
        flags.add(Flag.SERIAL_CONSISTENCY);
    return flags;
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:15,代码来源:QueryOptions.java

示例4: await

public void await() throws WriteTimeoutException
{
    try
    {
        if (!latch.await(DatabaseDescriptor.getWriteRpcTimeout(), TimeUnit.MILLISECONDS))
            throw new WriteTimeoutException(WriteType.CAS, ConsistencyLevel.SERIAL, getResponseCount(), targets);
    }
    catch (InterruptedException ex)
    {
        throw new AssertionError("This latch shouldn't have been interrupted.");
    }
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:12,代码来源:AbstractPaxosCallback.java

示例5: decode

public QueryOptions decode(ByteBuf body, ProtocolVersion version)
{
    ConsistencyLevel consistency = CBUtil.readConsistencyLevel(body);
    EnumSet<Flag> flags = Flag.deserialize(version.isGreaterOrEqualTo(ProtocolVersion.V5)
                                           ? (int)body.readUnsignedInt()
                                           : (int)body.readByte());

    List<ByteBuffer> values = Collections.<ByteBuffer>emptyList();
    List<String> names = null;
    if (flags.contains(Flag.VALUES))
    {
        if (flags.contains(Flag.NAMES_FOR_VALUES))
        {
            Pair<List<String>, List<ByteBuffer>> namesAndValues = CBUtil.readNameAndValueList(body, version);
            names = namesAndValues.left;
            values = namesAndValues.right;
        }
        else
        {
            values = CBUtil.readValueList(body, version);
        }
    }

    boolean skipMetadata = flags.contains(Flag.SKIP_METADATA);
    flags.remove(Flag.VALUES);
    flags.remove(Flag.SKIP_METADATA);

    SpecificOptions options = SpecificOptions.DEFAULT;
    if (!flags.isEmpty())
    {
        int pageSize = flags.contains(Flag.PAGE_SIZE) ? body.readInt() : -1;
        PagingState pagingState = flags.contains(Flag.PAGING_STATE) ? PagingState.deserialize(CBUtil.readValue(body), version) : null;
        ConsistencyLevel serialConsistency = flags.contains(Flag.SERIAL_CONSISTENCY) ? CBUtil.readConsistencyLevel(body) : ConsistencyLevel.SERIAL;
        long timestamp = Long.MIN_VALUE;
        if (flags.contains(Flag.TIMESTAMP))
        {
            long ts = body.readLong();
            if (ts == Long.MIN_VALUE)
                throw new ProtocolException(String.format("Out of bound timestamp, must be in [%d, %d] (got %d)", Long.MIN_VALUE + 1, Long.MAX_VALUE, ts));
            timestamp = ts;
        }

        options = new SpecificOptions(pageSize, pagingState, serialConsistency, timestamp);
    }
    DefaultQueryOptions opts = new DefaultQueryOptions(consistency, values, skipMetadata, options, version);
    return names == null ? opts : new OptionsWithNames(opts, names);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:47,代码来源:QueryOptions.java

示例6: SpecificOptions

private SpecificOptions(int pageSize, PagingState state, ConsistencyLevel serialConsistency)
{
    this.pageSize = pageSize;
    this.state = state;
    this.serialConsistency = serialConsistency == null ? ConsistencyLevel.SERIAL : serialConsistency;
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:6,代码来源:QueryOptions.java

示例7: decode

public QueryOptions decode(ByteBuf body, int version)
{
    ConsistencyLevel consistency = CBUtil.readConsistencyLevel(body);
    EnumSet<Flag> flags = Flag.deserialize((int)body.readByte());

    List<ByteBuffer> values = Collections.<ByteBuffer>emptyList();
    List<String> names = null;
    if (flags.contains(Flag.VALUES))
    {
        if (flags.contains(Flag.NAMES_FOR_VALUES))
        {
            Pair<List<String>, List<ByteBuffer>> namesAndValues = CBUtil.readNameAndValueList(body, version);
            names = namesAndValues.left;
            values = namesAndValues.right;
        }
        else
        {
            values = CBUtil.readValueList(body, version);
        }
    }

    boolean skipMetadata = flags.contains(Flag.SKIP_METADATA);
    flags.remove(Flag.VALUES);
    flags.remove(Flag.SKIP_METADATA);

    SpecificOptions options = SpecificOptions.DEFAULT;
    if (!flags.isEmpty())
    {
        int pageSize = flags.contains(Flag.PAGE_SIZE) ? body.readInt() : -1;
        PagingState pagingState = flags.contains(Flag.PAGING_STATE) ? PagingState.deserialize(CBUtil.readValue(body), version) : null;
        ConsistencyLevel serialConsistency = flags.contains(Flag.SERIAL_CONSISTENCY) ? CBUtil.readConsistencyLevel(body) : ConsistencyLevel.SERIAL;
        long timestamp = Long.MIN_VALUE;
        if (flags.contains(Flag.TIMESTAMP))
        {
            long ts = body.readLong();
            if (ts == Long.MIN_VALUE)
                throw new ProtocolException(String.format("Out of bound timestamp, must be in [%d, %d] (got %d)", Long.MIN_VALUE + 1, Long.MAX_VALUE, ts));
            timestamp = ts;
        }

        options = new SpecificOptions(pageSize, pagingState, serialConsistency, timestamp);
    }
    DefaultQueryOptions opts = new DefaultQueryOptions(consistency, values, skipMetadata, options, version);
    return names == null ? opts : new OptionsWithNames(opts, names);
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:45,代码来源:QueryOptions.java


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