use of org.apache.hadoop.hbase.util.SimpleMutableByteRange in project hbase by apache.
the class VisibilityUtils method createVisibilityLabelFilter.
public static Filter createVisibilityLabelFilter(Region region, Authorizations authorizations) throws IOException {
Map<ByteRange, Integer> cfVsMaxVersions = new HashMap<>();
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;
}
use of org.apache.hadoop.hbase.util.SimpleMutableByteRange in project hbase by apache.
the class PrefixTreeEncoder method initializeTagHelpers.
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();
}
use of org.apache.hadoop.hbase.util.SimpleMutableByteRange in project hbase by apache.
the class ByteRangeSet method store.
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);
// this isn't valid yet
storedRange.set(byteAppender, numBytes, bytes.getLength());
numBytes += bytes.getLength();
uniqueIndexByUniqueRange.put(storedRange, indexOfNewElement);
int newestUniqueIndex = numUniqueRanges;
++numUniqueRanges;
return newestUniqueIndex;
}
use of org.apache.hadoop.hbase.util.SimpleMutableByteRange in project hbase by apache.
the class TestByteRange method testConstructor.
@Test
public void testConstructor() {
ByteRange b = new SimpleMutableByteRange(new byte[] { 0, 1, 2 });
Assert.assertEquals(3, b.getLength());
}
use of org.apache.hadoop.hbase.util.SimpleMutableByteRange in project hbase by apache.
the class TestTreeDepth method testInternal.
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());
}
Aggregations