org.hbase.async.KeyValue.family()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(62)

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

KeyValue.family介绍

[英]Returns the column family.
[中]返回列族。

代码示例

代码示例来源:origin: fjfd/microscope

public DeleteCompactedCB(final ArrayList<KeyValue> cells) {
  final KeyValue first = cells.get(0);
  key = first.key();
  family = first.family();
  qualifiers = new byte[cells.size()][];
  for (int i = 0; i < qualifiers.length; i++) {
    qualifiers[i] = cells.get(i).qualifier();
  }
}

代码示例来源:origin: org.hbase/asynchbase

/**
 * Constructor to delete a specific cell.
 * @param table The table to edit.
 * @param kv The specific {@link KeyValue} to delete.  Note that if this
 * {@link KeyValue} specifies a timestamp, then this specific timestamp only
 * will be deleted.
 * @since 1.2
 */
public DeleteRequest(final byte[] table, final KeyValue kv) {
 this(table, kv.key(), kv.family(), new byte[][] { kv.qualifier() },
    kv.timestamp(), RowLock.NO_LOCK);
}

代码示例来源:origin: mallocator/Elasticsearch-HBase-River

/**
 * Generate a tree structure that ElasticSearch can read and index from one of the rows that has been returned from
 * HBase.
 * 
 * @param row
 * @return
 */
@SuppressWarnings("unchecked")
protected Map<String, Object> readDataTree(final ArrayList<KeyValue> row) {
  final Map<String, Object> dataTree = new HashMap<String, Object>();
  for (final KeyValue column : row) {
    final String family = this.river.normalizeField(new String(column.family(), this.river.getCharset()));
    final String qualifier = new String(column.qualifier(), this.river.getCharset());
    final String value = new String(column.value(), this.river.getCharset());
    if (!dataTree.containsKey(family)) {
      dataTree.put(family, new HashMap<String, Object>());
    }
    readQualifierStructure((Map<String, Object>) dataTree.get(family), qualifier, value);
  }
  return dataTree;
}

代码示例来源:origin: org.hbase/asynchbase

/** Private constructor.  */
private AppendRequest(final byte[] table,
          final byte[] key,
          final byte[] family,
          final byte[] qualifier,
          final byte[] value,
          final long timestamp,
          final long lockid) {
 this(table, key, family, new byte[][] { qualifier }, new byte[][] { value },
    timestamp, lockid, false);
}

代码示例来源:origin: org.hbase/asynchbase

/** Private constructor.  */
private PutRequest(final byte[] table,
          final byte[] key,
          final byte[] family,
          final byte[] qualifier,
          final byte[] value,
          final long timestamp,
          final long lockid) {
 this(table, key, family, new byte[][] { qualifier }, new byte[][] { value },
    timestamp, lockid);
}

代码示例来源:origin: fjfd/microscope

final KeyValue kv = new KeyValue(first.key(), first.family(),
    qualifier, value);
return kv;

代码示例来源:origin: fjfd/microscope

/**
 * Helper to print the cells in a given family for a given row, if any.
 *
 * @param row     The row to print.
 * @param family  Only cells in this family (if any) will be printed.
 * @param formard If true, this row contains a forward mapping (name to ID).
 *                Otherwise the row is assumed to contain a reverse mapping (ID to name).
 * @return {@code true} if at least one cell was printed.
 */
private static boolean printResult(final ArrayList<KeyValue> row,
                  final byte[] family,
                  final boolean formard) {
  final byte[] key = row.get(0).key();
  String name = formard ? fromBytes(key) : null;
  String id = formard ? null : Arrays.toString(key);
  boolean printed = false;
  for (final KeyValue kv : row) {
    if (!Bytes.equals(kv.family(), family)) {
      continue;
    }
    printed = true;
    if (formard) {
      id = Arrays.toString(kv.value());
    } else {
      name = fromBytes(kv.value());
    }
    System.out.println(fromBytes(kv.qualifier()) + ' ' + name + ": " + id);
  }
  return printed;
}

代码示例来源:origin: fjfd/microscope

final byte[] family = kv.family();
final byte[] value = kv.value();
if (Bytes.equals(key, MAXID_ROW)) {

代码示例来源:origin: fjfd/microscope

return new KeyValue(first.key(), first.family(), qualifier, value);

代码示例来源:origin: fjfd/microscope

if (fix) {
  client.put(new PutRequest(table, ordered.key(),
      ordered.family(),
      ordered.qualifier(),
      ordered.value()))
    client.put(new PutRequest(table, kv.key(), kv.family(),
        qual, value));
  } else {
final DeleteOutOfOrder delooo = new DeleteOutOfOrder(kv);
if (timestamp < prev.timestamp()) {
  client.put(new PutRequest(table, newkey, kv.family(),
      Bytes.fromShort(newqual), value))

代码示例来源:origin: org.hbase/asynchbase

/**
 * De-serializes an {@code hbase.client.Result} object.
 * @param buf The buffer that contains a serialized {@code Result}.
 * @return The result parsed into a list of {@link KeyValue} objects.
 */
private static ArrayList<KeyValue> parseResult(final ChannelBuffer buf) {
 final int length = buf.readInt();
 HBaseRpc.checkArrayLength(buf, length);
 //LOG.debug("total Result response length={}", length);
 final int num_kv = numberOfKeyValuesAhead(buf, length);
 final ArrayList<KeyValue> results = new ArrayList<KeyValue>(num_kv);
 KeyValue kv = null;
 for (int i = 0; i < num_kv; i++) {
  final int kv_length = buf.readInt();  // Previous loop checked it's >0.
  // Now read a KeyValue that spans over kv_length bytes.
  kv = KeyValue.fromBuffer(buf, kv);
  final int key_length = (2 + kv.key().length + 1 + kv.family().length
              + kv.qualifier().length + 8 + 1);   // XXX DEBUG
  if (key_length + kv.value().length + 4 + 4 != kv_length) {
   badResponse("kv_length=" + kv_length
         + " doesn't match key_length + value_length ("
         + key_length + " + " + kv.value().length + ") in " + buf
         + '=' + Bytes.pretty(buf));
  }
  results.add(kv);
 }
 return results;
}

代码示例来源:origin: org.hbase/asynchbase

/** Private constructor.  */
private DeleteRequest(final byte[] table,
           final byte[] key,
           final byte[] family,
           final byte[][] qualifiers,
           final long timestamp,
           final long lockid) {
 super(table, key, family == null ? WHOLE_ROW : family, timestamp, lockid);
 if (family != null) {
  KeyValue.checkFamily(family);
 }
 if (qualifiers != null) {
  if (family == null) {
   throw new IllegalArgumentException("You can't delete specific qualifiers"
    + " without specifying which family they belong to."
    + "  table=" + Bytes.pretty(table)
    + ", key=" + Bytes.pretty(key));
  }
  if (qualifiers.length == 0) {
   throw new IllegalArgumentException("Don't pass an empty list of"
    + " qualifiers, this would delete the entire row of table="
    + Bytes.pretty(table) + " at key " + Bytes.pretty(key));
  }
  for (final byte[] qualifier : qualifiers) {
   KeyValue.checkQualifier(qualifier);
  }
  this.qualifiers = qualifiers;
 } else {
  // No specific qualifier to delete: delete the entire family.  Not that

代码示例来源:origin: hbaseinaction/twitbase-async

static List<Deferred<Boolean>> doList(HBaseClient client)
  throws Throwable {
 final Scanner scanner = client.newScanner(TABLE_NAME);
 scanner.setFamily(INFO_FAM);
 scanner.setQualifier(PASSWORD_COL);
 ArrayList<ArrayList<KeyValue>> rows = null;
 ArrayList<Deferred<Boolean>> workers
  = new ArrayList<Deferred<Boolean>>();
 while ((rows = scanner.nextRows(1).joinUninterruptibly()) != null) {
  LOG.info("received a page of users.");
  for (ArrayList<KeyValue> row : rows) {
   KeyValue kv = row.get(0);
   byte[] expected = kv.value();
   String userId = new String(kv.key());
   PutRequest put = new PutRequest(
     TABLE_NAME, kv.key(), kv.family(),
     kv.qualifier(), mkNewPassword(expected));
   Deferred<Boolean> d = client.compareAndSet(put, expected)
    .addCallback(new InterpretResponse(userId))
    .addCallbacks(new ResultToMessage(), new FailureToMessage())
    .addCallback(new SendMessage());
   workers.add(d);
  }
 }
 return workers;
}

代码示例来源:origin: fjfd/microscope

final byte[] newqual = new byte[]{qual[0],
    fixQualifierFlags(qual[1], newval.length)};
kv = new KeyValue(kv.key(), kv.family(), newqual, newval);

相关文章

微信公众号

最新文章

更多