本文整理汇总了Java中org.apache.hadoop.hbase.util.SimpleMutableByteRange类的典型用法代码示例。如果您正苦于以下问题:Java SimpleMutableByteRange类的具体用法?Java SimpleMutableByteRange怎么用?Java SimpleMutableByteRange使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SimpleMutableByteRange类属于org.apache.hadoop.hbase.util包,在下文中一共展示了SimpleMutableByteRange类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: store
import org.apache.hadoop.hbase.util.SimpleMutableByteRange; //导入依赖的package包/类
protected int store(ByteRange bytes) {
int indexOfNewElement = numUniqueRanges;
if (uniqueRanges.size() <= numUniqueRanges) {
uniqueRanges.add(new SimpleMutableByteRange());
}
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;
}
示例2: VisibilityLabelFilter
import org.apache.hadoop.hbase.util.SimpleMutableByteRange; //导入依赖的package包/类
public VisibilityLabelFilter(VisibilityExpEvaluator expEvaluator,
Map<ByteRange, Integer> cfVsMaxVersions) {
this.expEvaluator = expEvaluator;
this.cfVsMaxVersions = cfVsMaxVersions;
this.curFamily = new SimpleMutableByteRange();
this.curQualifier = new SimpleMutableByteRange();
}
示例3: createVisibilityLabelFilter
import org.apache.hadoop.hbase.util.SimpleMutableByteRange; //导入依赖的package包/类
public static Filter createVisibilityLabelFilter(Region region, Authorizations authorizations)
throws IOException {
Map<ByteRange, Integer> cfVsMaxVersions = new HashMap<ByteRange, Integer>();
for (HColumnDescriptor hcd : region.getTableDesc().getFamilies()) {
cfVsMaxVersions.put(new SimpleMutableByteRange(hcd.getName()), hcd.getMaxVersions());
}
VisibilityLabelService vls = VisibilityLabelServiceManager.getInstance()
.getVisibilityLabelService();
Filter visibilityLabelFilter = new VisibilityLabelFilter(
vls.getVisibilityExpEvaluator(authorizations), cfVsMaxVersions);
return visibilityLabelFilter;
}
示例4: AccessControlFilter
import org.apache.hadoop.hbase.util.SimpleMutableByteRange; //导入依赖的package包/类
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 SimpleMutableByteRange();
this.prevQual = new SimpleMutableByteRange();
}
示例5: allocateBytes
import org.apache.hadoop.hbase.util.SimpleMutableByteRange; //导入依赖的package包/类
/**
* 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 SimpleMutableByteRange(c.data, allocOffset, size);
}
// not enough space!
// try to retire this chunk
tryRetireChunk(c);
}
}
示例6: PrefixTreeEncoder
import org.apache.hadoop.hbase.util.SimpleMutableByteRange; //导入依赖的package包/类
/***************** construct ***********************/
public PrefixTreeEncoder(OutputStream outputStream, boolean includeMvccVersion) {
// used during cell accumulation
this.blockMeta = new PrefixTreeBlockMeta();
this.rowRange = new SimpleMutableByteRange();
this.familyRange = new SimpleMutableByteRange();
this.qualifierRange = new SimpleMutableByteRange();
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);
}
示例7: initializeTagHelpers
import org.apache.hadoop.hbase.util.SimpleMutableByteRange; //导入依赖的package包/类
protected void initializeTagHelpers() {
this.tagsRange = new SimpleMutableByteRange();
this.tagsDeduplicator = USE_HASH_COLUMN_SORTER ? new ByteRangeHashSet()
: new ByteRangeTreeSet();
this.tagsTokenizer = new Tokenizer();
this.tagsWriter = new ColumnSectionWriter();
}
示例8: TokenizerNode
import org.apache.hadoop.hbase.util.SimpleMutableByteRange; //导入依赖的package包/类
/*********************** construct *****************************/
public TokenizerNode(Tokenizer builder, TokenizerNode parent, int nodeDepth,
int tokenStartOffset, int tokenOffset, int tokenLength) {
this.token = new SimpleMutableByteRange();
reconstruct(builder, parent, nodeDepth, tokenStartOffset, tokenOffset, tokenLength);
this.children = Lists.newArrayList();
}
示例9: testInternal
import org.apache.hadoop.hbase.util.SimpleMutableByteRange; //导入依赖的package包/类
protected void testInternal(List<String> inputs, int expectedTreeDepth) {
Tokenizer builder = new Tokenizer();
for (String s : inputs) {
SimpleMutableByteRange b = new SimpleMutableByteRange(Bytes.toBytes(s));
builder.addSorted(b);
}
Assert.assertEquals(1, builder.getRoot().getNodeDepth());
Assert.assertEquals(expectedTreeDepth, builder.getTreeDepth());
}
示例10: TestTokenizer
import org.apache.hadoop.hbase.util.SimpleMutableByteRange; //导入依赖的package包/类
public TestTokenizer(TestTokenizerData sortedByteArrays) {
this.inputs = sortedByteArrays.getInputs();
this.builder = new Tokenizer();
for (byte[] array : inputs) {
builder.addSorted(new SimpleMutableByteRange(array));
}
this.roundTripped = builder.getArrays();
}
示例11: createFirstKeyInIncrementedRow
import org.apache.hadoop.hbase.util.SimpleMutableByteRange; //导入依赖的package包/类
/**
* Increment the row bytes and clear the other fields
*/
public static KeyValue createFirstKeyInIncrementedRow(final Cell in){
byte[] thisRow = new SimpleMutableByteRange(in.getRowArray(), in.getRowOffset(),
in.getRowLength()).deepCopyToNewArray();
byte[] nextRow = Bytes.unsignedCopyAndIncrement(thisRow);
return createFirstOnRow(nextRow);
}
示例12: createVisibilityLabelFilter
import org.apache.hadoop.hbase.util.SimpleMutableByteRange; //导入依赖的package包/类
public static Filter createVisibilityLabelFilter(HRegion region, Authorizations authorizations)
throws IOException {
Map<ByteRange, Integer> cfVsMaxVersions = new HashMap<ByteRange, Integer>();
for (HColumnDescriptor hcd : region.getTableDesc().getFamilies()) {
cfVsMaxVersions.put(new SimpleMutableByteRange(hcd.getName()), hcd.getMaxVersions());
}
VisibilityLabelService vls = VisibilityLabelServiceManager.getInstance()
.getVisibilityLabelService();
Filter visibilityLabelFilter = new VisibilityLabelFilter(
vls.getVisibilityExpEvaluator(authorizations), cfVsMaxVersions);
return visibilityLabelFilter;
}
示例13: createVisibilityLabelFilter
import org.apache.hadoop.hbase.util.SimpleMutableByteRange; //导入依赖的package包/类
public static Filter createVisibilityLabelFilter(Region region, Authorizations authorizations)
throws IOException {
Map<ByteRange, Integer> cfVsMaxVersions = new HashMap<>();
for (ColumnFamilyDescriptor hcd : region.getTableDescriptor().getColumnFamilies()) {
cfVsMaxVersions.put(new SimpleMutableByteRange(hcd.getName()), hcd.getMaxVersions());
}
VisibilityLabelService vls = VisibilityLabelServiceManager.getInstance()
.getVisibilityLabelService();
Filter visibilityLabelFilter = new VisibilityLabelFilter(
vls.getVisibilityExpEvaluator(authorizations), cfVsMaxVersions);
return visibilityLabelFilter;
}
示例14: getToken
import org.apache.hadoop.hbase.util.SimpleMutableByteRange; //导入依赖的package包/类
public byte[] getToken() {
// TODO pass in reusable ByteRange
return new SimpleMutableByteRange(block, tokenOffset, tokenLength).deepCopyToNewArray();
}
示例15: getValueByteRange
import org.apache.hadoop.hbase.util.SimpleMutableByteRange; //导入依赖的package包/类
public ByteRange getValueByteRange() {
return new SimpleMutableByteRange(values, 0, totalValueBytes);
}