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


Java ByteBufferUtil.UNSET_BYTE_BUFFER属性代码示例

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


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

示例1: getTimestamp

public long getTimestamp(long now, QueryOptions options) throws InvalidRequestException
{
    if (timestamp == null)
        return now;

    ByteBuffer tval = timestamp.bindAndGet(options);
    if (tval == null)
        throw new InvalidRequestException("Invalid null value of timestamp");

    if (tval == ByteBufferUtil.UNSET_BYTE_BUFFER)
        return now;

    try
    {
        LongType.instance.validate(tval);
    }
    catch (MarshalException e)
    {
        throw new InvalidRequestException("Invalid timestamp value: " + tval);
    }

    return LongType.instance.compose(tval);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:23,代码来源:Attributes.java

示例2: bindInternal

private ByteBuffer[] bindInternal(QueryOptions options) throws InvalidRequestException
{
    if (elements.size() > type.size())
        throw new InvalidRequestException(String.format(
                "Tuple value contained too many fields (expected %s, got %s)", type.size(), elements.size()));

    ByteBuffer[] buffers = new ByteBuffer[elements.size()];
    for (int i = 0; i < elements.size(); i++)
    {
        buffers[i] = elements.get(i).bindAndGet(options);
        // Since A tuple value is always written in its entirety Cassandra can't preserve a pre-existing value by 'not setting' the new value. Reject the query.
        if (buffers[i] == ByteBufferUtil.UNSET_BYTE_BUFFER)
            throw new InvalidRequestException(String.format("Invalid unset value for tuple field number %d", i));
    }
    return buffers;
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:16,代码来源:Tuples.java

示例3: bind

public Terminal bind(QueryOptions options) throws InvalidRequestException
{
    SortedSet<ByteBuffer> buffers = new TreeSet<>(comparator);
    for (Term t : elements)
    {
        ByteBuffer bytes = t.bindAndGet(options);

        if (bytes == null)
            throw new InvalidRequestException("null is not supported inside collections");
        if (bytes == ByteBufferUtil.UNSET_BYTE_BUFFER)
            return UNSET_VALUE;

        buffers.add(bytes);
    }
    return new Value(buffers);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:16,代码来源:Sets.java

示例4: doAdd

static void doAdd(Term.Terminal value, ColumnDefinition column, UpdateParameters params) throws InvalidRequestException
{
    if (column.type.isMultiCell())
    {
        if (value == null)
            return;

        for (ByteBuffer bb : ((Value) value).elements)
        {
            if (bb == ByteBufferUtil.UNSET_BYTE_BUFFER)
                continue;

            params.addCell(column, CellPath.create(bb), ByteBufferUtil.EMPTY_BYTE_BUFFER);
        }
    }
    else
    {
        // for frozen sets, we're overwriting the whole cell
        if (value == null)
            params.addTombstone(column);
        else
            params.addCell(column, value.get(ProtocolVersion.CURRENT));
    }
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:24,代码来源:Sets.java

示例5: bind

public Terminal bind(QueryOptions options) throws InvalidRequestException
{
    List<ByteBuffer> buffers = new ArrayList<ByteBuffer>(elements.size());
    for (Term t : elements)
    {
        ByteBuffer bytes = t.bindAndGet(options);

        if (bytes == null)
            throw new InvalidRequestException("null is not supported inside collections");
        if (bytes == ByteBufferUtil.UNSET_BYTE_BUFFER)
            return UNSET_VALUE;

        buffers.add(bytes);
    }
    return new Value(buffers);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:16,代码来源:Lists.java

示例6: addElementToAll

public MultiCBuilder addElementToAll(ByteBuffer value)
{
    checkUpdateable();

    if (elementsList.isEmpty())
        elementsList.add(new ArrayList<ByteBuffer>());

    if (value == null)
        containsNull = true;
    else if (value == ByteBufferUtil.UNSET_BYTE_BUFFER)
        containsUnset = true;

    for (int i = 0, m = elementsList.size(); i < m; i++)
        elementsList.get(i).add(value);

    size++;
    return this;
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:18,代码来源:MultiCBuilder.java

示例7: bind

public Terminal bind(QueryOptions options) throws InvalidRequestException
{
    Map<ByteBuffer, ByteBuffer> buffers = new TreeMap<ByteBuffer, ByteBuffer>(comparator);
    for (Map.Entry<Term, Term> entry : elements.entrySet())
    {
        // We don't support values > 64K because the serialization format encode the length as an unsigned short.
        ByteBuffer keyBytes = entry.getKey().bindAndGet(options);

        if (keyBytes == null)
            throw new InvalidRequestException("null is not supported inside collections");
        if (keyBytes == ByteBufferUtil.UNSET_BYTE_BUFFER)
            throw new InvalidRequestException("unset value is not supported for map keys");

        ByteBuffer valueBytes = entry.getValue().bindAndGet(options);
        if (valueBytes == null)
            throw new InvalidRequestException("null is not supported inside collections");
        if (valueBytes == ByteBufferUtil.UNSET_BYTE_BUFFER)
            return UNSET_VALUE;

        buffers.put(keyBytes, valueBytes);
    }
    return new Value(buffers);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:23,代码来源:Maps.java

示例8: readBoundValue

public static ByteBuffer readBoundValue(ByteBuf cb, ProtocolVersion protocolVersion)
{
    int length = cb.readInt();
    if (length < 0)
    {
        if (protocolVersion.isSmallerThan(ProtocolVersion.V4)) // backward compatibility for pre-version 4
            return null;
        if (length == -1)
            return null;
        else if (length == -2)
            return ByteBufferUtil.UNSET_BYTE_BUFFER;
        else
            throw new ProtocolException("Invalid ByteBuf length " + length);
    }
    ByteBuf slice = cb.readSlice(length);

    return ByteBuffer.wrap(readRawBytes(slice));
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:18,代码来源:CBUtil.java

示例9: getTimeToLive

public int getTimeToLive(QueryOptions options, int defaultTimeToLive) throws InvalidRequestException
{
    if (timeToLive == null)
        return defaultTimeToLive;

    ByteBuffer tval = timeToLive.bindAndGet(options);
    if (tval == null)
        return 0;

    if (tval == ByteBufferUtil.UNSET_BYTE_BUFFER)
        return defaultTimeToLive;

    try
    {
        Int32Type.instance.validate(tval);
    }
    catch (MarshalException e)
    {
        throw new InvalidRequestException("Invalid timestamp value: " + tval);
    }

    int ttl = Int32Type.instance.compose(tval);
    if (ttl < 0)
        throw new InvalidRequestException("A TTL must be greater or equal to 0, but was " + ttl);

    if (ttl > MAX_TTL)
        throw new InvalidRequestException(String.format("ttl is too large. requested (%d) maximum (%d)", ttl, MAX_TTL));

    if (defaultTimeToLive != LivenessInfo.NO_TTL && ttl == LivenessInfo.NO_TTL)
        return LivenessInfo.NO_TTL;

    return ttl;
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:33,代码来源:Attributes.java

示例10: bind

public Value bind(QueryOptions options) throws InvalidRequestException
{
    ByteBuffer value = options.getValues().get(bindIndex);
    if (value == ByteBufferUtil.UNSET_BYTE_BUFFER)
        throw new InvalidRequestException(String.format("Invalid unset value for tuple %s", receiver.name));
    return value == null ? null : Value.fromSerialized(value, (TupleType)receiver.type);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:7,代码来源:Tuples.java

示例11: addEachElementToAll

public MultiCBuilder addEachElementToAll(List<ByteBuffer> values)
{
    checkUpdateable();

    if (elementsList.isEmpty())
        elementsList.add(new ArrayList<ByteBuffer>());

    if (values.isEmpty())
    {
        hasMissingElements = true;
    }
    else
    {
        for (int i = 0, m = elementsList.size(); i < m; i++)
        {
            List<ByteBuffer> oldComposite = elementsList.remove(0);

            for (int j = 0, n = values.size(); j < n; j++)
            {
                List<ByteBuffer> newComposite = new ArrayList<>(oldComposite);
                elementsList.add(newComposite);

                ByteBuffer value = values.get(j);

                if (value == null)
                    containsNull = true;
                if (value == ByteBufferUtil.UNSET_BYTE_BUFFER)
                    containsUnset = true;

                newComposite.add(values.get(j));
            }
        }
    }
    size++;
    return this;
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:36,代码来源:MultiCBuilder.java

示例12: bind

public Terminal bind(QueryOptions options) throws InvalidRequestException
{
    ByteBuffer value = options.getValues().get(bindIndex);
    if (value == null)
        return null;
    if (value == ByteBufferUtil.UNSET_BYTE_BUFFER)
        return UNSET_VALUE;
    return Value.fromSerialized(value, (UserType) receiver.type);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:9,代码来源:UserTypes.java

示例13: bindAndGet

@Override
public ByteBuffer bindAndGet(QueryOptions options) throws InvalidRequestException
{
    try
    {
        ByteBuffer value = options.getValues().get(bindIndex);
        if (value != null && value != ByteBufferUtil.UNSET_BYTE_BUFFER)
            receiver.type.validate(value);
        return value;
    }
    catch (MarshalException e)
    {
        throw new InvalidRequestException(e.getMessage());
    }
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:15,代码来源:Constants.java

示例14: bind

public Value bind(QueryOptions options) throws InvalidRequestException
{
    ByteBuffer bytes = bindAndGet(options);
    if (bytes == null)
        return null;
    if (bytes == ByteBufferUtil.UNSET_BYTE_BUFFER)
        return Constants.UNSET_VALUE;
    return new Constants.Value(bytes);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:9,代码来源:Constants.java

示例15: execute

public void execute(DecoratedKey partitionKey, UpdateParameters params) throws InvalidRequestException
{
    ByteBuffer bytes = t.bindAndGet(params.options);
    if (bytes == null)
        throw new InvalidRequestException("Invalid null value for counter increment");
    if (bytes == ByteBufferUtil.UNSET_BYTE_BUFFER)
        return;

    long increment = ByteBufferUtil.toLong(bytes);
    params.addCounter(column, increment);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:11,代码来源:Constants.java


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