当前位置: 首页>>代码示例>>Java>>正文


Java Tag.getTagOffset方法代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.Tag.getTagOffset方法的典型用法代码示例。如果您正苦于以下问题:Java Tag.getTagOffset方法的具体用法?Java Tag.getTagOffset怎么用?Java Tag.getTagOffset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hbase.Tag的用法示例。


在下文中一共展示了Tag.getTagOffset方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: extractVisibilityTags

import org.apache.hadoop.hbase.Tag; //导入方法依赖的package包/类
/**
 * Extract the visibility tags of the given Cell into the given List
 * @param cell - the cell
 * @param tags - the array that will be populated if visibility tags are present
 * @return The visibility tags serialization format
 */
public static Byte extractVisibilityTags(Cell cell, List<Tag> tags) {
  Byte serializationFormat = null;
  if (cell.getTagsLength() > 0) {
    Iterator<Tag> tagsIterator = CellUtil.tagsIterator(cell.getTagsArray(), cell.getTagsOffset(),
        cell.getTagsLength());
    while (tagsIterator.hasNext()) {
      Tag tag = tagsIterator.next();
      if (tag.getType() == TagType.VISIBILITY_EXP_SERIALIZATION_FORMAT_TAG_TYPE) {
        serializationFormat = tag.getBuffer()[tag.getTagOffset()];
      } else if (tag.getType() == VISIBILITY_TAG_TYPE) {
        tags.add(tag);
      }
    }
  }
  return serializationFormat;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:23,代码来源:VisibilityUtils.java

示例2: extractAndPartitionTags

import org.apache.hadoop.hbase.Tag; //导入方法依赖的package包/类
/**
 * Extracts and partitions the visibility tags and nonVisibility Tags
 *
 * @param cell - the cell for which we would extract and partition the
 * visibility and non visibility tags
 * @param visTags
 *          - all the visibilty tags of type TagType.VISIBILITY_TAG_TYPE would
 *          be added to this list
 * @param nonVisTags - all the non visibility tags would be added to this list
 * @return - the serailization format of the tag. Can be null if no tags are found or
 * if there is no visibility tag found
 */
public static Byte extractAndPartitionTags(Cell cell, List<Tag> visTags,
    List<Tag> nonVisTags) {
  Byte serializationFormat = null;
  if (cell.getTagsLength() > 0) {
    Iterator<Tag> tagsIterator = CellUtil.tagsIterator(cell.getTagsArray(), cell.getTagsOffset(),
        cell.getTagsLength());
    while (tagsIterator.hasNext()) {
      Tag tag = tagsIterator.next();
      if (tag.getType() == TagType.VISIBILITY_EXP_SERIALIZATION_FORMAT_TAG_TYPE) {
        serializationFormat = tag.getBuffer()[tag.getTagOffset()];
      } else if (tag.getType() == VISIBILITY_TAG_TYPE) {
        visTags.add(tag);
      } else {
        // ignore string encoded visibility expressions, will be added in replication handling
        nonVisTags.add(tag);
      }
    }
  }
  return serializationFormat;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:33,代码来源:VisibilityUtils.java

示例3: getSortedTagOrdinals

import org.apache.hadoop.hbase.Tag; //导入方法依赖的package包/类
private static void getSortedTagOrdinals(List<List<Integer>> fullTagsList, Tag tag)
    throws IOException {
  List<Integer> tagsOrdinalInSortedOrder = new ArrayList<Integer>();
  int offset = tag.getTagOffset();
  int endOffset = offset + tag.getTagLength();
  while (offset < endOffset) {
    Pair<Integer, Integer> result = StreamUtils.readRawVarint32(tag.getBuffer(), offset);
    tagsOrdinalInSortedOrder.add(result.getFirst());
    offset += result.getSecond();
  }
  Collections.sort(tagsOrdinalInSortedOrder);
  fullTagsList.add(tagsOrdinalInSortedOrder);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:14,代码来源:DefaultVisibilityLabelServiceImpl.java

示例4: filterKeyValue

import org.apache.hadoop.hbase.Tag; //导入方法依赖的package包/类
@Override
public ReturnCode filterKeyValue(Cell cell) throws IOException {
  if (curFamily.getBytes() == null
      || (Bytes.compareTo(curFamily.getBytes(), curFamily.getOffset(), curFamily.getLength(),
          cell.getFamilyArray(), cell.getFamilyOffset(), cell.getFamilyLength()) != 0)) {
    curFamily.set(cell.getFamilyArray(), cell.getFamilyOffset(), cell.getFamilyLength());
    // For this family, all the columns can have max of curFamilyMaxVersions versions. No need to
    // consider the older versions for visibility label check.
    // Ideally this should have been done at a lower layer by HBase (?)
    curFamilyMaxVersions = cfVsMaxVersions.get(curFamily);
    // Family is changed. Just unset curQualifier.
    curQualifier.unset();
  }
  if (curQualifier.getBytes() == null
      || (Bytes.compareTo(curQualifier.getBytes(), curQualifier.getOffset(),
          curQualifier.getLength(), cell.getQualifierArray(), cell.getQualifierOffset(),
          cell.getQualifierLength()) != 0)) {
    curQualifier.set(cell.getQualifierArray(), cell.getQualifierOffset(),
        cell.getQualifierLength());
    curQualMetVersions = 0;
  }
  curQualMetVersions++;
  if (curQualMetVersions > curFamilyMaxVersions) {
    return ReturnCode.SKIP;
  }

  Iterator<Tag> tagsItr = CellUtil.tagsIterator(cell.getTagsArray(), cell.getTagsOffset(),
      cell.getTagsLength());
  boolean visibilityTagPresent = false;
  while (tagsItr.hasNext()) {
    boolean includeKV = true;
    Tag tag = tagsItr.next();
    if (tag.getType() == VisibilityUtils.VISIBILITY_TAG_TYPE) {
      visibilityTagPresent = true;
      int offset = tag.getTagOffset();
      int endOffset = offset + tag.getTagLength();
      while (offset < endOffset) {
        Pair<Integer, Integer> result = StreamUtils.readRawVarint32(tag.getBuffer(), offset);
        int currLabelOrdinal = result.getFirst();
        if (currLabelOrdinal < 0) {
          // check for the absence of this label in the Scan Auth labels
          // ie. to check BitSet corresponding bit is 0
          int temp = -currLabelOrdinal;
          if (this.authLabels.get(temp)) {
            includeKV = false;
            break;
          }
        } else {
          if (!this.authLabels.get(currLabelOrdinal)) {
            includeKV = false;
            break;
          }
        }
        offset += result.getSecond();
      }
      if (includeKV) {
        // We got one visibility expression getting evaluated to true. Good to include this KV in
        // the result then.
        return ReturnCode.INCLUDE;
      }
    }
  }
  return visibilityTagPresent ? ReturnCode.SKIP : ReturnCode.INCLUDE;
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:65,代码来源:VisibilityLabelFilter.java


注:本文中的org.apache.hadoop.hbase.Tag.getTagOffset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。