/** * @param cell The Cell * @return Tags in the given Cell as a List * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0. * Use {@link RawCell#getTags()} */ @Deprecated public static List<Tag> getTags(Cell cell) { return PrivateCellUtil.getTags(cell); }
@Override public void postGetOp(ObserverContext<RegionCoprocessorEnvironment> e, Get get, List<Cell> results) throws IOException { if (results.size() > 0) { // Check tag presence in the 1st cell in 1st Result if (!results.isEmpty()) { Cell cell = results.get(0); tags = PrivateCellUtil.getTags(cell); } } } }
@Override public void postGetOp(ObserverContext<RegionCoprocessorEnvironment> e, Get get, List<Cell> results) throws IOException { if (results.size() > 0) { // Check tag presence in the 1st cell in 1st Result if (!results.isEmpty()) { Cell cell = results.get(0); tags = PrivateCellUtil.getTags(cell); } } } }
private static Map<String, Object> cellToStringMap(Cell c) { Map<String, Object> stringMap = new HashMap<>(); stringMap.put("qualifier", Bytes.toStringBinary(c.getQualifierArray(), c.getQualifierOffset(), c.getQualifierLength())); stringMap.put("timestamp", c.getTimestamp()); stringMap.put("vlen", c.getValueLength()); List<Tag> tags = PrivateCellUtil.getTags(c); if (tags != null) { List<String> tagsString = new ArrayList<>(tags.size()); for (Tag t : tags) { tagsString .add((t.getType()) + ":" + Bytes.toStringBinary(Tag.cloneValue(t))); } stringMap.put("tag", tagsString); } return stringMap; }
@Override public boolean postScannerNext(ObserverContext<RegionCoprocessorEnvironment> e, InternalScanner s, List<Result> results, int limit, boolean hasMore) throws IOException { if (checkTagPresence) { if (results.size() > 0) { // Check tag presence in the 1st cell in 1st Result Result result = results.get(0); CellScanner cellScanner = result.cellScanner(); if (cellScanner.advance()) { Cell cell = cellScanner.current(); tags = PrivateCellUtil.getTags(cell); } } } return hasMore; } }
@Override public void prePut(ObserverContext<RegionCoprocessorEnvironment> e, Put m, WALEdit edit, Durability durability) throws IOException { byte[] attribute = m.getAttribute(NON_VISIBILITY); byte[] cf = null; List<Cell> updatedCells = new ArrayList<>(); if (attribute != null) { for (List<? extends Cell> edits : m.getFamilyCellMap().values()) { for (Cell cell : edits) { KeyValue kv = KeyValueUtil.ensureKeyValue(cell); if (cf == null) { cf = CellUtil.cloneFamily(kv); } Tag tag = new ArrayBackedTag((byte) NON_VIS_TAG_TYPE, attribute); List<Tag> tagList = new ArrayList<>(PrivateCellUtil.getTags(cell).size() + 1); tagList.add(tag); tagList.addAll(PrivateCellUtil.getTags(cell)); Cell newcell = PrivateCellUtil.createCell(kv, tagList); ((List<Cell>) updatedCells).add(newcell); } } m.getFamilyCellMap().remove(cf); // Update the family map m.getFamilyCellMap().put(cf, updatedCells); } } }
cell.getValueLength())); int i = 0; List<Tag> tags = PrivateCellUtil.getTags(cell); for (Tag tag : tags) { out.print(String.format(" T[%d]: %s", i++, tag.toString()));
decoder.advance(); KeyValue kv = (KeyValue) decoder.current(); List<Tag> tags = PrivateCellUtil.getTags(kv); assertEquals(1, tags.size()); assertEquals("tagValue1", Bytes.toString(Tag.cloneValue(tags.get(0)))); decoder.advance(); kv = (KeyValue) decoder.current(); tags = PrivateCellUtil.getTags(kv); assertEquals(0, tags.size()); decoder.advance(); kv = (KeyValue) decoder.current(); tags = PrivateCellUtil.getTags(kv); assertEquals(2, tags.size()); assertEquals("tagValue1", Bytes.toString(Tag.cloneValue(tags.get(0))));
scanner.seekTo(); Cell cell = scanner.getCell(); List<Tag> tagsFromCell = PrivateCellUtil.getTags(cell); assertTrue(tagsFromCell.size() > 0); for (Tag tag : tagsFromCell) {
protected static void doAssert(byte[] row, String visTag) throws Exception { if (VisibilityReplicationEndPointForTest.lastEntries == null) { return; // first call } Assert.assertEquals(1, VisibilityReplicationEndPointForTest.lastEntries.size()); List<Cell> cells = VisibilityReplicationEndPointForTest.lastEntries.get(0).getEdit().getCells(); Assert.assertEquals(4, cells.size()); boolean tagFound = false; for (Cell cell : cells) { if ((Bytes.equals(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength(), row, 0, row.length))) { List<Tag> tags = PrivateCellUtil.getTags(cell); for (Tag tag : tags) { if (tag.getType() == TagType.STRING_VIS_TAG_TYPE) { assertEquals(visTag, Tag.getValueAsString(tag)); tagFound = true; break; } } } } assertTrue(tagFound); }
assertTrue(CellUtil.equals(c, kv1)); List<Tag> tags = PrivateCellUtil.getTags(c); assertEquals(2, tags.size()); Tag tag = tags.get(0); c = decoder.current(); assertTrue(CellUtil.equals(c, kv2)); tags = PrivateCellUtil.getTags(c); assertEquals(1, tags.size()); tag = tags.get(0); c = decoder.current(); assertTrue(CellUtil.equals(c, kv3)); tags = PrivateCellUtil.getTags(c); assertEquals(3, tags.size()); tag = tags.get(0);
assertTrue(CellUtil.equals(c, cell1)); List<Tag> tags = PrivateCellUtil.getTags(c); assertEquals(2, tags.size()); Tag tag = tags.get(0); c = decoder.current(); assertTrue(CellUtil.equals(c, cell2)); tags = PrivateCellUtil.getTags(c); assertEquals(1, tags.size()); tag = tags.get(0); c = decoder.current(); assertTrue(CellUtil.equals(c, cell3)); tags = PrivateCellUtil.getTags(c); assertEquals(3, tags.size()); tag = tags.get(0);
for (CellScanner cellScanner = m.cellScanner(); cellScanner.advance();) { Cell cell = cellScanner.current(); List<Tag> tags = PrivateCellUtil.getTags(cell); if (modifiedTagFound) {
assertTrue(Bytes.equals(key5, 0, key5.length, kv.getRowArray(), kv.getRowOffset(), kv.getRowLength())); List<Tag> tags = PrivateCellUtil.getTags(kv); assertEquals(1, tags.size()); assertEquals("tag3", Bytes.toString(Tag.cloneValue(tags.get(0))));
assertTrue(Bytes.equals(kv.getValueArray(), kv.getValueOffset(), kv.getValueLength(), value, 0, value.length)); List<Tag> tags = PrivateCellUtil.getTags(kv); assertNotNull(tags); assertEquals(2, tags.size());
assertEquals(Type.Put.getCode(), offheapKV.getTypeByte()); List<Tag> resTags = PrivateCellUtil.getTags(offheapKV); Tag tag1 = resTags.get(0); assertEquals(t1.getType(), tag1.getType());
private static Map<String, Object> cellToStringMap(Cell c) { Map<String, Object> stringMap = new HashMap<>(); stringMap.put("qualifier", Bytes.toStringBinary(c.getQualifierArray(), c.getQualifierOffset(), c.getQualifierLength())); stringMap.put("timestamp", c.getTimestamp()); stringMap.put("vlen", c.getValueLength()); List<Tag> tags = PrivateCellUtil.getTags(c); if (tags != null) { List<String> tagsString = new ArrayList<>(tags.size()); for (Tag t : tags) { tagsString .add((t.getType()) + ":" + Bytes.toStringBinary(Tag.cloneValue(t))); } stringMap.put("tag", tagsString); } return stringMap; }
@Override public void postGetOp(ObserverContext<RegionCoprocessorEnvironment> e, Get get, List<Cell> results) throws IOException { if (results.size() > 0) { // Check tag presence in the 1st cell in 1st Result if (!results.isEmpty()) { Cell cell = results.get(0); tags = PrivateCellUtil.getTags(cell); } } } }
@Override public void postGetOp(ObserverContext<RegionCoprocessorEnvironment> e, Get get, List<Cell> results) throws IOException { if (results.size() > 0) { // Check tag presence in the 1st cell in 1st Result if (!results.isEmpty()) { Cell cell = results.get(0); tags = PrivateCellUtil.getTags(cell); } } } }
@Override public boolean postScannerNext(ObserverContext<RegionCoprocessorEnvironment> e, InternalScanner s, List<Result> results, int limit, boolean hasMore) throws IOException { if (checkTagPresence) { if (results.size() > 0) { // Check tag presence in the 1st cell in 1st Result Result result = results.get(0); CellScanner cellScanner = result.cellScanner(); if (cellScanner.advance()) { Cell cell = cellScanner.current(); tags = PrivateCellUtil.getTags(cell); } } } return hasMore; } }