當前位置: 首頁>>代碼示例>>Java>>正文


Java KeyValue.Type方法代碼示例

本文整理匯總了Java中org.apache.hadoop.hbase.KeyValue.Type方法的典型用法代碼示例。如果您正苦於以下問題:Java KeyValue.Type方法的具體用法?Java KeyValue.Type怎麽用?Java KeyValue.Type使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.hbase.KeyValue的用法示例。


在下文中一共展示了KeyValue.Type方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: toDeleteType

import org.apache.hadoop.hbase.KeyValue; //導入方法依賴的package包/類
/**
 * Convert a delete KeyValue type to protocol buffer DeleteType.
 *
 * @param type
 * @return protocol buffer DeleteType
 * @throws IOException
 */
public static DeleteType toDeleteType(
    KeyValue.Type type) throws IOException {
  switch (type) {
  case Delete:
    return DeleteType.DELETE_ONE_VERSION;
  case DeleteColumn:
    return DeleteType.DELETE_MULTIPLE_VERSIONS;
  case DeleteFamily:
    return DeleteType.DELETE_FAMILY;
  case DeleteFamilyVersion:
    return DeleteType.DELETE_FAMILY_VERSION;
  default:
      throw new IOException("Unknown delete type: " + type);
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:23,代碼來源:ProtobufUtil.java

示例2: fromDeleteType

import org.apache.hadoop.hbase.KeyValue; //導入方法依賴的package包/類
/**
 * Convert a protocol buffer DeleteType to delete KeyValue type.
 *
 * @param type The DeleteType
 * @return The type.
 * @throws IOException
 */
public static KeyValue.Type fromDeleteType(
    DeleteType type) throws IOException {
  switch (type) {
  case DELETE_ONE_VERSION:
    return KeyValue.Type.Delete;
  case DELETE_MULTIPLE_VERSIONS:
    return KeyValue.Type.DeleteColumn;
  case DELETE_FAMILY:
    return KeyValue.Type.DeleteFamily;
  case DELETE_FAMILY_VERSION:
    return KeyValue.Type.DeleteFamilyVersion;
  default:
    throw new IOException("Unknown delete type: " + type);
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:23,代碼來源:ProtobufUtil.java

示例3: generateKeyType

import org.apache.hadoop.hbase.KeyValue; //導入方法依賴的package包/類
public static KeyValue.Type generateKeyType(Random rand) {
  if (rand.nextBoolean()) {
    // Let's make half of KVs puts.
    return KeyValue.Type.Put;
  } else {
    KeyValue.Type keyType =
        KeyValue.Type.values()[1 + rand.nextInt(NUM_VALID_KEY_TYPES)];
    if (keyType == KeyValue.Type.Minimum || keyType == KeyValue.Type.Maximum)
    {
      throw new RuntimeException("Generated an invalid key type: " + keyType
          + ". " + "Probably the layout of KeyValue.Type has changed.");
    }
    return keyType;
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:16,代碼來源:CreateRandomStoreFile.java

示例4: generateKeyType

import org.apache.hadoop.hbase.KeyValue; //導入方法依賴的package包/類
private static KeyValue.Type generateKeyType(Random rand) {
  if (rand.nextBoolean()) {
    // Let's make half of KVs puts.
    return KeyValue.Type.Put;
  } else {
    KeyValue.Type keyType =
        KeyValue.Type.values()[1 + rand.nextInt(NUM_VALID_KEY_TYPES)];
    if (keyType == KeyValue.Type.Minimum || keyType == KeyValue.Type.Maximum)
    {
      throw new RuntimeException("Generated an invalid key type: " + keyType
          + ". " + "Probably the layout of KeyValue.Type has changed.");
    }
    return keyType;
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:16,代碼來源:TestCacheOnWriteInSchema.java

示例5: generateKeyType

import org.apache.hadoop.hbase.KeyValue; //導入方法依賴的package包/類
public static KeyValue.Type generateKeyType(Random rand) {
  if (rand.nextBoolean()) {
    // Let's make half of KVs puts.
    return KeyValue.Type.Put;
  } else {
    KeyValue.Type keyType = KeyValue.Type.values()[1 + rand.nextInt(NUM_VALID_KEY_TYPES)];
    if (keyType == KeyValue.Type.Minimum || keyType == KeyValue.Type.Maximum) {
      throw new RuntimeException("Generated an invalid key type: " + keyType + ". "
          + "Probably the layout of KeyValue.Type has changed.");
    }
    return keyType;
  }
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:14,代碼來源:TestCacheOnWrite.java

示例6: toMutation

import org.apache.hadoop.hbase.KeyValue; //導入方法依賴的package包/類
public static MutationProto toMutation(final MutationType type, final Mutation mutation,
    MutationProto.Builder builder, long nonce)
throws IOException {
  builder = getMutationBuilderAndSetCommonFields(type, mutation, builder);
  if (nonce != HConstants.NO_NONCE) {
    builder.setNonce(nonce);
  }
  ColumnValue.Builder columnBuilder = ColumnValue.newBuilder();
  QualifierValue.Builder valueBuilder = QualifierValue.newBuilder();
  for (Map.Entry<byte[],List<Cell>> family: mutation.getFamilyCellMap().entrySet()) {
    columnBuilder.clear();
    columnBuilder.setFamily(ByteStringer.wrap(family.getKey()));
    for (Cell cell: family.getValue()) {
      valueBuilder.clear();
      valueBuilder.setQualifier(ByteStringer.wrap(
          cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength()));
      valueBuilder.setValue(ByteStringer.wrap(
          cell.getValueArray(), cell.getValueOffset(), cell.getValueLength()));
      valueBuilder.setTimestamp(cell.getTimestamp());
      if (type == MutationType.DELETE || (type == MutationType.PUT && CellUtil.isDelete(cell))) {
        KeyValue.Type keyValueType = KeyValue.Type.codeToType(cell.getTypeByte());
        valueBuilder.setDeleteType(toDeleteType(keyValueType));
      }
      columnBuilder.addQualifierValue(valueBuilder.build());
    }
    builder.addColumnValue(columnBuilder.build());
  }
  return builder.build();
}
 
開發者ID:fengchen8086,項目名稱:ditb,代碼行數:30,代碼來源:ProtobufUtil.java


注:本文中的org.apache.hadoop.hbase.KeyValue.Type方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。