org.apache.hadoop.hbase.client.Increment.setCellVisibility()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(114)

本文整理了Java中org.apache.hadoop.hbase.client.Increment.setCellVisibility()方法的一些代码示例,展示了Increment.setCellVisibility()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Increment.setCellVisibility()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.client.Increment
类名称:Increment
方法名:setCellVisibility

Increment.setCellVisibility介绍

暂无

代码示例

代码示例来源:origin: apache/hbase

@Test
public void testLabelsWithIncrement() throws Throwable {
 TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
 try (Table table = TEST_UTIL.createTable(tableName, fam)) {
  byte[] row1 = Bytes.toBytes("row1");
  byte[] val = Bytes.toBytes(1L);
  Put put = new Put(row1);
  put.addColumn(fam, qual, HConstants.LATEST_TIMESTAMP, val);
  put.setCellVisibility(new CellVisibility(SECRET + " & " + CONFIDENTIAL));
  table.put(put);
  Get get = new Get(row1);
  get.setAuthorizations(new Authorizations(SECRET));
  Result result = table.get(get);
  assertTrue(result.isEmpty());
  table.incrementColumnValue(row1, fam, qual, 2L);
  result = table.get(get);
  assertTrue(result.isEmpty());
  Increment increment = new Increment(row1);
  increment.addColumn(fam, qual, 2L);
  increment.setCellVisibility(new CellVisibility(SECRET));
  table.increment(increment);
  result = table.get(get);
  assertTrue(!result.isEmpty());
 }
}

代码示例来源:origin: apache/hbase

public static Increment incrementFromThrift(TIncrement in) throws IOException {
 Increment out = new Increment(in.getRow());
 for (TColumnIncrement column : in.getColumns()) {
  out.addColumn(column.getFamily(), column.getQualifier(), column.getAmount());
 }
 if (in.isSetAttributes()) {
  addAttributes(out,in.getAttributes());
 }
 if (in.isSetDurability()) {
  out.setDurability(durabilityFromThrift(in.getDurability()));
 }
 if(in.getCellVisibility() != null) {
  out.setCellVisibility(new CellVisibility(in.getCellVisibility().getExpression()));
 }
 if (in.isSetReturnResults()) {
  out.setReturnResults(in.isReturnResults());
 }
 return out;
}

代码示例来源:origin: org.apache.hbase/hbase-server

@Test
public void testLabelsWithIncrement() throws Throwable {
 TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
 try (Table table = TEST_UTIL.createTable(tableName, fam)) {
  byte[] row1 = Bytes.toBytes("row1");
  byte[] val = Bytes.toBytes(1L);
  Put put = new Put(row1);
  put.addColumn(fam, qual, HConstants.LATEST_TIMESTAMP, val);
  put.setCellVisibility(new CellVisibility(SECRET + " & " + CONFIDENTIAL));
  table.put(put);
  Get get = new Get(row1);
  get.setAuthorizations(new Authorizations(SECRET));
  Result result = table.get(get);
  assertTrue(result.isEmpty());
  table.incrementColumnValue(row1, fam, qual, 2L);
  result = table.get(get);
  assertTrue(result.isEmpty());
  Increment increment = new Increment(row1);
  increment.addColumn(fam, qual, 2L);
  increment.setCellVisibility(new CellVisibility(SECRET));
  table.increment(increment);
  result = table.get(get);
  assertTrue(!result.isEmpty());
 }
}

代码示例来源:origin: com.aliyun.hbase/alihbase-thrift

public static Increment incrementFromThrift(TIncrement in) throws IOException {
 Increment out = new Increment(in.getRow());
 for (TColumnIncrement column : in.getColumns()) {
  out.addColumn(column.getFamily(), column.getQualifier(), column.getAmount());
 }
 if (in.isSetAttributes()) {
  addAttributes(out,in.getAttributes());
 }
 if (in.isSetDurability()) {
  out.setDurability(durabilityFromThrift(in.getDurability()));
 }
 if(in.getCellVisibility() != null) {
  out.setCellVisibility(new CellVisibility(in.getCellVisibility().getExpression()));
 }
 return out;
}

代码示例来源:origin: org.apache.hbase/hbase-thrift

public static Increment incrementFromThrift(TIncrement in) throws IOException {
 Increment out = new Increment(in.getRow());
 for (TColumnIncrement column : in.getColumns()) {
  out.addColumn(column.getFamily(), column.getQualifier(), column.getAmount());
 }
 if (in.isSetAttributes()) {
  addAttributes(out,in.getAttributes());
 }
 if (in.isSetDurability()) {
  out.setDurability(durabilityFromThrift(in.getDurability()));
 }
 if(in.getCellVisibility() != null) {
  out.setCellVisibility(new CellVisibility(in.getCellVisibility().getExpression()));
 }
 return out;
}

相关文章