use of org.apache.hadoop.hbase.Cell in project hbase by apache.
the class AccessControlLists method parsePermissions.
private static ListMultimap<String, TablePermission> parsePermissions(byte[] entryName, Result result) {
ListMultimap<String, TablePermission> perms = ArrayListMultimap.create();
if (result != null && result.size() > 0) {
for (Cell kv : result.rawCells()) {
Pair<String, TablePermission> permissionsOfUserOnTable = parsePermissionRecord(entryName, kv);
if (permissionsOfUserOnTable != null) {
String username = permissionsOfUserOnTable.getFirst();
TablePermission permissions = permissionsOfUserOnTable.getSecond();
perms.put(username, permissions);
}
}
}
return perms;
}
use of org.apache.hadoop.hbase.Cell in project hbase by apache.
the class ChainWALEntryFilter method filterCells.
private void filterCells(Entry entry) {
if (entry == null || cellFilters.length == 0) {
return;
}
ArrayList<Cell> cells = entry.getEdit().getCells();
int size = cells.size();
for (int i = size - 1; i >= 0; i--) {
Cell cell = cells.get(i);
for (WALCellFilter filter : cellFilters) {
cell = filter.filterCell(entry, cell);
if (cell != null) {
cells.set(i, cell);
} else {
cells.remove(i);
break;
}
}
}
if (cells.size() < size / 2) {
cells.trimToSize();
}
}
use of org.apache.hadoop.hbase.Cell in project hbase by apache.
the class ProtobufLogWriter method append.
@Override
public void append(Entry entry) throws IOException {
entry.setCompressionContext(compressionContext);
entry.getKey().getBuilder(compressor).setFollowingKvCount(entry.getEdit().size()).build().writeDelimitedTo(output);
for (Cell cell : entry.getEdit().getCells()) {
// cellEncoder must assume little about the stream, since we write PB and cells in turn.
cellEncoder.write(cell);
}
length.set(output.getPos());
}
use of org.apache.hadoop.hbase.Cell in project hbase by apache.
the class AsyncProtobufLogWriter method append.
@Override
public void append(Entry entry) {
int buffered = output.buffered();
entry.setCompressionContext(compressionContext);
try {
entry.getKey().getBuilder(compressor).setFollowingKvCount(entry.getEdit().size()).build().writeDelimitedTo(asyncOutputWrapper);
} catch (IOException e) {
throw new AssertionError("should not happen", e);
}
try {
for (Cell cell : entry.getEdit().getCells()) {
cellEncoder.write(cell);
}
} catch (IOException e) {
throw new AssertionError("should not happen", e);
}
length.addAndGet(output.buffered() - buffered);
}
use of org.apache.hadoop.hbase.Cell in project hbase by apache.
the class FSWALEntry method stampRegionSequenceId.
/**
* Here is where a WAL edit gets its sequenceid. SIDE-EFFECT is our stamping the sequenceid into
* every Cell AND setting the sequenceid into the MVCC WriteEntry!!!!
* @return The sequenceid we stamped on this edit.
*/
long stampRegionSequenceId(MultiVersionConcurrencyControl.WriteEntry we) throws IOException {
long regionSequenceId = we.getWriteNumber();
if (!this.getEdit().isReplay() && inMemstore) {
for (Cell c : getEdit().getCells()) {
CellUtil.setSequenceId(c, regionSequenceId);
}
}
getKey().setWriteEntry(we);
return regionSequenceId;
}
Aggregations