Java 类org.apache.hadoop.hbase.util.SimpleByteRange 实例源码

项目:HIndex    文件:ByteRangeSet.java   
protected int store(ByteRange bytes) {
  int indexOfNewElement = numUniqueRanges;
  if (uniqueRanges.size() <= numUniqueRanges) {
    uniqueRanges.add(new SimpleByteRange());
  }
  ByteRange storedRange = uniqueRanges.get(numUniqueRanges);
  int neededBytes = numBytes + bytes.getLength();
  byteAppender = ArrayUtils.growIfNecessary(byteAppender, neededBytes, 2 * neededBytes);
  bytes.deepCopyTo(byteAppender, numBytes);
  storedRange.set(byteAppender, numBytes, bytes.getLength());// this isn't valid yet
  numBytes += bytes.getLength();
  uniqueIndexByUniqueRange.put(storedRange, indexOfNewElement);
  int newestUniqueIndex = numUniqueRanges;
  ++numUniqueRanges;
  return newestUniqueIndex;
}
项目:PyroDB    文件:ByteRangeSet.java   
protected int store(ByteRange bytes) {
  int indexOfNewElement = numUniqueRanges;
  if (uniqueRanges.size() <= numUniqueRanges) {
    uniqueRanges.add(new SimpleByteRange());
  }
  ByteRange storedRange = uniqueRanges.get(numUniqueRanges);
  int neededBytes = numBytes + bytes.getLength();
  byteAppender = ArrayUtils.growIfNecessary(byteAppender, neededBytes, 2 * neededBytes);
  bytes.deepCopyTo(byteAppender, numBytes);
  storedRange.set(byteAppender, numBytes, bytes.getLength());// this isn't valid yet
  numBytes += bytes.getLength();
  uniqueIndexByUniqueRange.put(storedRange, indexOfNewElement);
  int newestUniqueIndex = numUniqueRanges;
  ++numUniqueRanges;
  return newestUniqueIndex;
}
项目:c5    文件:ByteRangeSet.java   
protected int store(ByteRange bytes) {
  int indexOfNewElement = numUniqueRanges;
  if (uniqueRanges.size() <= numUniqueRanges) {
    uniqueRanges.add(new SimpleByteRange());
  }
  ByteRange storedRange = uniqueRanges.get(numUniqueRanges);
  int neededBytes = numBytes + bytes.getLength();
  byteAppender = ArrayUtils.growIfNecessary(byteAppender, neededBytes, 2 * neededBytes);
  bytes.deepCopyTo(byteAppender, numBytes);
  storedRange.set(byteAppender, numBytes, bytes.getLength());// this isn't valid yet
  numBytes += bytes.getLength();
  uniqueIndexByUniqueRange.put(storedRange, indexOfNewElement);
  int newestUniqueIndex = numUniqueRanges;
  ++numUniqueRanges;
  return newestUniqueIndex;
}
项目:HIndex    文件:AccessControlFilter.java   
AccessControlFilter(TableAuthManager mgr, User ugi, TableName tableName,
    Strategy strategy, Map<ByteRange, Integer> cfVsMaxVersions) {
  authManager = mgr;
  table = tableName;
  user = ugi;
  isSystemTable = tableName.isSystemTable();
  this.strategy = strategy;
  this.cfVsMaxVersions = cfVsMaxVersions;
  this.prevFam = new SimpleByteRange();
  this.prevQual = new SimpleByteRange();
}
项目:HIndex    文件:PrefixTreeEncoder.java   
/***************** construct ***********************/

  public PrefixTreeEncoder(OutputStream outputStream, boolean includeMvccVersion) {
    // used during cell accumulation
    this.blockMeta = new PrefixTreeBlockMeta();
    this.rowRange = new SimpleByteRange();
    this.familyRange = new SimpleByteRange();
    this.qualifierRange = new SimpleByteRange();
    this.timestamps = new long[INITIAL_PER_CELL_ARRAY_SIZES];
    this.mvccVersions = new long[INITIAL_PER_CELL_ARRAY_SIZES];
    this.typeBytes = new byte[INITIAL_PER_CELL_ARRAY_SIZES];
    this.valueOffsets = new int[INITIAL_PER_CELL_ARRAY_SIZES];
    this.values = new byte[VALUE_BUFFER_INIT_SIZE];

    // used during compilation
    this.familyDeduplicator = USE_HASH_COLUMN_SORTER ? new ByteRangeHashSet()
        : new ByteRangeTreeSet();
    this.qualifierDeduplicator = USE_HASH_COLUMN_SORTER ? new ByteRangeHashSet()
        : new ByteRangeTreeSet();
    this.timestampEncoder = new LongEncoder();
    this.mvccVersionEncoder = new LongEncoder();
    this.cellTypeEncoder = new CellTypeEncoder();
    this.rowTokenizer = new Tokenizer();
    this.familyTokenizer = new Tokenizer();
    this.qualifierTokenizer = new Tokenizer();
    this.rowWriter = new RowSectionWriter();
    this.familyWriter = new ColumnSectionWriter();
    this.qualifierWriter = new ColumnSectionWriter();
    initializeTagHelpers();

    reset(outputStream, includeMvccVersion);
  }
项目:HIndex    文件:PrefixTreeEncoder.java   
protected void initializeTagHelpers() {
  this.tagsRange = new SimpleByteRange();
  this.tagsDeduplicator = USE_HASH_COLUMN_SORTER ? new ByteRangeHashSet()
  : new ByteRangeTreeSet();
  this.tagsTokenizer = new Tokenizer();
  this.tagsWriter = new ColumnSectionWriter();
}
项目:HIndex    文件:TokenizerNode.java   
/*********************** construct *****************************/

  public TokenizerNode(Tokenizer builder, TokenizerNode parent, int nodeDepth,
      int tokenStartOffset, int tokenOffset, int tokenLength) {
    this.token = new SimpleByteRange();
    reconstruct(builder, parent, nodeDepth, tokenStartOffset, tokenOffset, tokenLength);
    this.children = Lists.newArrayList();
  }
项目:HIndex    文件:TestTreeDepth.java   
protected void testInternal(List<String> inputs, int expectedTreeDepth) {
  Tokenizer builder = new Tokenizer();
  for (String s : inputs) {
    SimpleByteRange b = new SimpleByteRange(Bytes.toBytes(s));
    builder.addSorted(b);
  }
  Assert.assertEquals(1, builder.getRoot().getNodeDepth());
  Assert.assertEquals(expectedTreeDepth, builder.getTreeDepth());
}
项目:HIndex    文件:TestTokenizer.java   
public TestTokenizer(TestTokenizerData sortedByteArrays) {
  this.inputs = sortedByteArrays.getInputs();
  this.builder = new Tokenizer();
  for (byte[] array : inputs) {
    builder.addSorted(new SimpleByteRange(array));
  }
  this.roundTripped = builder.getArrays();
}
项目:HIndex    文件:KeyValueUtil.java   
/**
 * Increment the row bytes and clear the other fields
 */
public static KeyValue createFirstKeyInIncrementedRow(final Cell in){
  byte[] thisRow = new SimpleByteRange(in.getRowArray(), in.getRowOffset(), in.getRowLength())
      .deepCopyToNewArray();
  byte[] nextRow = Bytes.unsignedCopyAndIncrement(thisRow);
  return KeyValue.createFirstOnRow(nextRow);
}
项目:PyroDB    文件:AccessControlFilter.java   
AccessControlFilter(TableAuthManager mgr, User ugi, TableName tableName,
    Strategy strategy, Map<ByteRange, Integer> cfVsMaxVersions) {
  authManager = mgr;
  table = tableName;
  user = ugi;
  isSystemTable = tableName.isSystemTable();
  this.strategy = strategy;
  this.cfVsMaxVersions = cfVsMaxVersions;
  this.prevFam = new SimpleByteRange();
  this.prevQual = new SimpleByteRange();
}
项目:PyroDB    文件:HeapMemStoreLAB.java   
/**
 * Allocate a slice of the given length.
 *
 * If the size is larger than the maximum size specified for this
 * allocator, returns null.
 */
@Override
public ByteRange allocateBytes(int size) {
  Preconditions.checkArgument(size >= 0, "negative size");

  // Callers should satisfy large allocations directly from JVM since they
  // don't cause fragmentation as badly.
  if (size > maxAlloc) {
    return null;
  }

  while (true) {
    Chunk c = getOrMakeChunk();

    // Try to allocate from this chunk
    int allocOffset = c.alloc(size);
    if (allocOffset != -1) {
      // We succeeded - this is the common case - small alloc
      // from a big buffer
      return new SimpleByteRange(c.data, allocOffset, size);
    }

    // not enough space!
    // try to retire this chunk
    tryRetireChunk(c);
  }
}
项目:PyroDB    文件:PrefixTreeEncoder.java   
/***************** construct ***********************/

  public PrefixTreeEncoder(OutputStream outputStream, boolean includeMvccVersion) {
    // used during cell accumulation
    this.blockMeta = new PrefixTreeBlockMeta();
    this.rowRange = new SimpleByteRange();
    this.familyRange = new SimpleByteRange();
    this.qualifierRange = new SimpleByteRange();
    this.timestamps = new long[INITIAL_PER_CELL_ARRAY_SIZES];
    this.mvccVersions = new long[INITIAL_PER_CELL_ARRAY_SIZES];
    this.typeBytes = new byte[INITIAL_PER_CELL_ARRAY_SIZES];
    this.valueOffsets = new int[INITIAL_PER_CELL_ARRAY_SIZES];
    this.values = new byte[VALUE_BUFFER_INIT_SIZE];

    // used during compilation
    this.familyDeduplicator = USE_HASH_COLUMN_SORTER ? new ByteRangeHashSet()
        : new ByteRangeTreeSet();
    this.qualifierDeduplicator = USE_HASH_COLUMN_SORTER ? new ByteRangeHashSet()
        : new ByteRangeTreeSet();
    this.timestampEncoder = new LongEncoder();
    this.mvccVersionEncoder = new LongEncoder();
    this.cellTypeEncoder = new CellTypeEncoder();
    this.rowTokenizer = new Tokenizer();
    this.familyTokenizer = new Tokenizer();
    this.qualifierTokenizer = new Tokenizer();
    this.rowWriter = new RowSectionWriter();
    this.familyWriter = new ColumnSectionWriter();
    this.qualifierWriter = new ColumnSectionWriter();
    initializeTagHelpers();

    reset(outputStream, includeMvccVersion);
  }
项目:PyroDB    文件:PrefixTreeEncoder.java   
protected void initializeTagHelpers() {
  this.tagsRange = new SimpleByteRange();
  this.tagsDeduplicator = USE_HASH_COLUMN_SORTER ? new ByteRangeHashSet()
  : new ByteRangeTreeSet();
  this.tagsTokenizer = new Tokenizer();
  this.tagsWriter = new ColumnSectionWriter();
}
项目:PyroDB    文件:TokenizerNode.java   
/*********************** construct *****************************/

  public TokenizerNode(Tokenizer builder, TokenizerNode parent, int nodeDepth,
      int tokenStartOffset, int tokenOffset, int tokenLength) {
    this.token = new SimpleByteRange();
    reconstruct(builder, parent, nodeDepth, tokenStartOffset, tokenOffset, tokenLength);
    this.children = Lists.newArrayList();
  }
项目:PyroDB    文件:TestTreeDepth.java   
protected void testInternal(List<String> inputs, int expectedTreeDepth) {
  Tokenizer builder = new Tokenizer();
  for (String s : inputs) {
    SimpleByteRange b = new SimpleByteRange(Bytes.toBytes(s));
    builder.addSorted(b);
  }
  Assert.assertEquals(1, builder.getRoot().getNodeDepth());
  Assert.assertEquals(expectedTreeDepth, builder.getTreeDepth());
}
项目:PyroDB    文件:TestTokenizer.java   
public TestTokenizer(TestTokenizerData sortedByteArrays) {
  this.inputs = sortedByteArrays.getInputs();
  this.builder = new Tokenizer();
  for (byte[] array : inputs) {
    builder.addSorted(new SimpleByteRange(array));
  }
  this.roundTripped = builder.getArrays();
}
项目:PyroDB    文件:KeyValueUtil.java   
/**
 * Increment the row bytes and clear the other fields
 */
public static KeyValue createFirstKeyInIncrementedRow(final Cell in){
  byte[] thisRow = new SimpleByteRange(in.getRowArray(), in.getRowOffset(), in.getRowLength())
      .deepCopyToNewArray();
  byte[] nextRow = Bytes.unsignedCopyAndIncrement(thisRow);
  return createFirstOnRow(nextRow);
}
项目:c5    文件:PrefixTreeEncoder.java   
/***************** construct ***********************/

  public PrefixTreeEncoder(OutputStream outputStream, boolean includeMvccVersion) {
    // used during cell accumulation
    this.blockMeta = new PrefixTreeBlockMeta();
    this.rowRange = new SimpleByteRange();
    this.familyRange = new SimpleByteRange();
    this.qualifierRange = new SimpleByteRange();
    this.timestamps = new long[INITIAL_PER_CELL_ARRAY_SIZES];
    this.mvccVersions = new long[INITIAL_PER_CELL_ARRAY_SIZES];
    this.typeBytes = new byte[INITIAL_PER_CELL_ARRAY_SIZES];
    this.valueOffsets = new int[INITIAL_PER_CELL_ARRAY_SIZES];
    this.values = new byte[VALUE_BUFFER_INIT_SIZE];

    // used during compilation
    this.familyDeduplicator = USE_HASH_COLUMN_SORTER ? new ByteRangeHashSet()
        : new ByteRangeTreeSet();
    this.qualifierDeduplicator = USE_HASH_COLUMN_SORTER ? new ByteRangeHashSet()
        : new ByteRangeTreeSet();
    this.timestampEncoder = new LongEncoder();
    this.mvccVersionEncoder = new LongEncoder();
    this.cellTypeEncoder = new CellTypeEncoder();
    this.rowTokenizer = new Tokenizer();
    this.familyTokenizer = new Tokenizer();
    this.qualifierTokenizer = new Tokenizer();
    this.rowWriter = new RowSectionWriter();
    this.familyWriter = new ColumnSectionWriter();
    this.qualifierWriter = new ColumnSectionWriter();

    reset(outputStream, includeMvccVersion);
  }
项目:c5    文件:TokenizerNode.java   
/*********************** construct *****************************/

  public TokenizerNode(Tokenizer builder, TokenizerNode parent, int nodeDepth,
      int tokenStartOffset, int tokenOffset, int tokenLength) {
    this.token = new SimpleByteRange();
    reconstruct(builder, parent, nodeDepth, tokenStartOffset, tokenOffset, tokenLength);
    this.children = Lists.newArrayList();
  }
项目:c5    文件:TestTreeDepth.java   
protected void testInternal(List<String> inputs, int expectedTreeDepth) {
  Tokenizer builder = new Tokenizer();
  for (String s : inputs) {
    SimpleByteRange b = new SimpleByteRange(Bytes.toBytes(s));
    builder.addSorted(b);
  }
  Assert.assertEquals(1, builder.getRoot().getNodeDepth());
  Assert.assertEquals(expectedTreeDepth, builder.getTreeDepth());
}
项目:c5    文件:TestTokenizer.java   
public TestTokenizer(TestTokenizerData sortedByteArrays) {
  this.inputs = sortedByteArrays.getInputs();
  this.builder = new Tokenizer();
  for (byte[] array : inputs) {
    builder.addSorted(new SimpleByteRange(array));
  }
  this.roundTripped = builder.getArrays();
}
项目:c5    文件:KeyValueUtil.java   
/**
 * Increment the row bytes and clear the other fields
 */
public static KeyValue createFirstKeyInIncrementedRow(final Cell in){
  byte[] thisRow = new SimpleByteRange(in.getRowArray(), in.getRowOffset(), in.getRowLength())
      .deepCopyToNewArray();
  byte[] nextRow = Bytes.unsignedCopyAndIncrement(thisRow);
  return KeyValue.createFirstOnRow(nextRow);
}
项目:HIndex    文件:VisibilityLabelFilter.java   
public VisibilityLabelFilter(BitSet authLabels, Map<ByteRange, Integer> cfVsMaxVersions) {
  this.authLabels = authLabels;
  this.cfVsMaxVersions = cfVsMaxVersions;
  this.curFamily = new SimpleByteRange();
  this.curQualifier = new SimpleByteRange();
}
项目:HIndex    文件:RowNodeReader.java   
public byte[] getToken() {
  // TODO pass in reusable ByteRange
  return new SimpleByteRange(block, tokenOffset, tokenLength).deepCopyToNewArray();
}
项目:HIndex    文件:PrefixTreeEncoder.java   
public ByteRange getValueByteRange() {
  return new SimpleByteRange(values, 0, totalValueBytes);
}
项目:HIndex    文件:TestByteRange.java   
@Test
public void testConstructor() {
  ByteRange b = new SimpleByteRange(new byte[] { 0, 1, 2 });
  Assert.assertEquals(3, b.getLength());
}
项目:PyroDB    文件:VisibilityLabelFilter.java   
public VisibilityLabelFilter(BitSet authLabels, Map<ByteRange, Integer> cfVsMaxVersions) {
  this.authLabels = authLabels;
  this.cfVsMaxVersions = cfVsMaxVersions;
  this.curFamily = new SimpleByteRange();
  this.curQualifier = new SimpleByteRange();
}
项目:PyroDB    文件:RowNodeReader.java   
public byte[] getToken() {
  // TODO pass in reusable ByteRange
  return new SimpleByteRange(block, tokenOffset, tokenLength).deepCopyToNewArray();
}
项目:PyroDB    文件:PrefixTreeEncoder.java   
public ByteRange getValueByteRange() {
  return new SimpleByteRange(values, 0, totalValueBytes);
}
项目:PyroDB    文件:TestByteRange.java   
@Test
public void testConstructor() {
  ByteRange b = new SimpleByteRange(new byte[] { 0, 1, 2 });
  Assert.assertEquals(3, b.getLength());
}
项目:c5    文件:RowNodeReader.java   
public byte[] getToken() {
  // TODO pass in reusable ByteRange
  return new SimpleByteRange(block, tokenOffset, tokenLength).deepCopyToNewArray();
}
项目:c5    文件:PrefixTreeEncoder.java   
public ByteRange getValueByteRange() {
  return new SimpleByteRange(values, 0, totalValueBytes);
}
项目:c5    文件:TestByteRange.java   
@Test
public void testConstructor() {
  ByteRange b = new SimpleByteRange(new byte[] { 0, 1, 2 });
  Assert.assertEquals(3, b.getLength());
}