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

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

java 2次浏览

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

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

示例1: NativeDecoratedKey

点赞 2

import org.apache.cassandra.utils.memory.NativeAllocator; //导入依赖的package包/类
public NativeDecoratedKey(Token token, NativeAllocator allocator, OpOrder.Group writeOp, ByteBuffer key)
{
    super(token);
    assert key != null;
    assert key.order() == ByteOrder.BIG_ENDIAN;

    int size = key.remaining();
    this.peer = allocator.allocate(4 + size, writeOp);
    MemoryUtil.setInt(peer, size);
    MemoryUtil.setBytes(peer + 4, key);
}
 

开发者ID:Netflix,
项目名称:sstable-adaptor,
代码行数:12,
代码来源:NativeDecoratedKey.java

示例2: NativeClustering

点赞 2

import org.apache.cassandra.utils.memory.NativeAllocator; //导入依赖的package包/类
public NativeClustering(NativeAllocator allocator, OpOrder.Group writeOp, Clustering clustering)
{
    int count = clustering.size();
    int metadataSize = (count * 2) + 4;
    int dataSize = clustering.dataSize();
    int bitmapSize = ((count + 7) >>> 3);

    assert count < 64 << 10;
    assert dataSize < 64 << 10;

    peer = allocator.allocate(metadataSize + dataSize + bitmapSize, writeOp);
    long bitmapStart = peer + metadataSize;
    MemoryUtil.setShort(peer, (short) count);
    MemoryUtil.setShort(peer + (metadataSize - 2), (short) dataSize); // goes at the end of the other offsets

    MemoryUtil.setByte(bitmapStart, bitmapSize, (byte) 0);
    long dataStart = peer + metadataSize + bitmapSize;
    int dataOffset = 0;
    for (int i = 0 ; i < count ; i++)
    {
        MemoryUtil.setShort(peer + 2 + i * 2, (short) dataOffset);

        ByteBuffer value = clustering.get(i);
        if (value == null)
        {
            long boffset = bitmapStart + (i >>> 3);
            int b = MemoryUtil.getByte(boffset);
            b |= 1 << (i & 7);
            MemoryUtil.setByte(boffset, (byte) b);
            continue;
        }

        assert value.order() == ByteOrder.BIG_ENDIAN;

        int size = value.remaining();
        MemoryUtil.setBytes(dataStart + dataOffset, value);
        dataOffset += size;
    }
}
 

开发者ID:Netflix,
项目名称:sstable-adaptor,
代码行数:40,
代码来源:NativeClustering.java

示例3: NativeCell

点赞 2

import org.apache.cassandra.utils.memory.NativeAllocator; //导入依赖的package包/类
public NativeCell(NativeAllocator allocator,
                  OpOrder.Group writeOp,
                  Cell cell)
{
    this(allocator,
         writeOp,
         cell.column(),
         cell.timestamp(),
         cell.ttl(),
         cell.localDeletionTime(),
         cell.value(),
         cell.path());
}
 

开发者ID:Netflix,
项目名称:sstable-adaptor,
代码行数:14,
代码来源:NativeCell.java

示例4: NativeDecoratedKey

点赞 2

import org.apache.cassandra.utils.memory.NativeAllocator; //导入依赖的package包/类
public NativeDecoratedKey(Token token, NativeAllocator allocator, OpOrder.Group writeOp, ByteBuffer key)
{
    super(token);
    assert key != null;
    int size = key.remaining();
    this.peer = allocator.allocate(4 + size, writeOp);
    MemoryUtil.setInt(peer, size);
    MemoryUtil.setBytes(peer + 4, key);
}
 

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

示例5: NativeExpiringCell

点赞 2

import org.apache.cassandra.utils.memory.NativeAllocator; //导入依赖的package包/类
public NativeExpiringCell(NativeAllocator allocator, OpOrder.Group writeOp, ExpiringCell copyOf)
{
    super(allocator, writeOp, copyOf);
}
 

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

示例6: NativeDeletedCell

点赞 2

import org.apache.cassandra.utils.memory.NativeAllocator; //导入依赖的package包/类
public NativeDeletedCell(NativeAllocator allocator, OpOrder.Group writeOp, DeletedCell copyOf)
{
    super(allocator, writeOp, copyOf);
}
 

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

示例7: NativeCell

点赞 2

import org.apache.cassandra.utils.memory.NativeAllocator; //导入依赖的package包/类
public NativeCell(NativeAllocator allocator, OpOrder.Group writeOp, Cell copyOf)
{
    super(allocator, writeOp, copyOf);
}
 

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

示例8: NativeCounterCell

点赞 2

import org.apache.cassandra.utils.memory.NativeAllocator; //导入依赖的package包/类
public NativeCounterCell(NativeAllocator allocator, OpOrder.Group writeOp, CounterCell copyOf)
{
    super(allocator, writeOp, copyOf);
}
 

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


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