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


Java PartialKey类代码示例

本文整理汇总了Java中org.apache.accumulo.core.data.PartialKey的典型用法代码示例。如果您正苦于以下问题:Java PartialKey类的具体用法?Java PartialKey怎么用?Java PartialKey使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PartialKey类属于org.apache.accumulo.core.data包,在下文中一共展示了PartialKey类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setRangesTest

import org.apache.accumulo.core.data.PartialKey; //导入依赖的package包/类
private void setRangesTest(String configuration) throws Exception {
  List<String> rows = Arrays.asList("row1", "row2");
  List<String> colFs = Arrays.asList("colF1", "colF2");
  List<String> colQs = Arrays.asList("colQ1", "colQ2");
  List<String> colVs = Collections.singletonList("");
  List<String> values = Collections.singletonList("value");

  clearTable();
  EncryptedBatchWriter writer = getEncryptedWriter(CHARLIE, configuration);
  writeData(writer, rows, colFs, colQs, colVs, values);
  writer.close();

  EncryptedBatchScanner scanner = getEncryptedScanner(CHARLIE, configuration);
  scanner.setRanges(Collections.singletonList(new Range(new Key("row1", "colF1", "colQ1"), true, new Key("row1", "colF1", "colQ2")
      .followingKey(PartialKey.ROW_COLFAM_COLQUAL), false)));
  assertThat("contains the filtered data", scanner, hasData(Collections.singletonList("row1"), Collections.singletonList("colF1"), colQs, colVs, values));
}
 
开发者ID:mit-ll,项目名称:PACE,代码行数:18,代码来源:FilteringIT.java

示例2: appendServerSideRanges

import org.apache.accumulo.core.data.PartialKey; //导入依赖的package包/类
/**
 * @param serverSideRanges
 *          List of server side filters.
 * @param originalRange
 *          Range to convert.
 * @param startKeys
 *          Set of start key filters.
 * @param endKeys
 *          Set of end key filters.
 * @param prefix
 *          What portion of the key are we filtering?
 */
private void appendServerSideRanges(Collection<Range> serverSideRanges, Range originalRange, List<MutableEntry> startKeys, List<MutableEntry> endKeys,
    PartialKey prefix) {
  if (prefix == null) {
    serverSideRanges.add(new Range());
    return;
  }

  if (originalRange.isInfiniteStartKey()) {
    for (MutableEntry endKey : endKeys) {
      serverSideRanges.add(new Range(null, true, endKey.toKey().followingKey(prefix), false));
    }
  } else if (originalRange.isInfiniteStopKey()) {
    for (MutableEntry startKey : startKeys) {
      serverSideRanges.add(new Range(startKey.toKey(), true, null, true));
    }
  } else {
    Iterator<MutableEntry> startKeyIterator = startKeys.iterator();
    Iterator<MutableEntry> endKeyIterator = endKeys.iterator();
    while (startKeyIterator.hasNext()) {
      serverSideRanges.add(new Range(startKeyIterator.next().toKey(), true, endKeyIterator.next().toKey().followingKey(prefix), false));
    }
  }
}
 
开发者ID:mit-ll,项目名称:PACE,代码行数:36,代码来源:EntryEncryptor.java

示例3: toPartialKey

import org.apache.accumulo.core.data.PartialKey; //导入依赖的package包/类
/**
 * Converts the field to a partial key.
 *
 * @param field
 *          Field to transform.
 * @return The partial key that ends with this field.
 */
private static PartialKey toPartialKey(EntryField field) {
  switch (field) {
    case ROW:
      return PartialKey.ROW;
    case COLUMN_FAMILY:
      return PartialKey.ROW_COLFAM;
    case COLUMN_QUALIFIER:
      return PartialKey.ROW_COLFAM_COLQUAL;
    case COLUMN_VISIBILITY:
      return PartialKey.ROW_COLFAM_COLQUAL_COLVIS;
    case TIMESTAMP:
      return PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME;
    case DELETE:
      return PartialKey.ROW_COLFAM_COLQUAL_COLVIS_TIME_DEL;
    default:
      throw new IllegalArgumentException();
  }
}
 
开发者ID:mit-ll,项目名称:PACE,代码行数:26,代码来源:EntryEncryptor.java

示例4: runTest

import org.apache.accumulo.core.data.PartialKey; //导入依赖的package包/类
private void runTest(boolean reseek, TreeMap<Key,Value> source, TreeMap<Key,Value> result, Collection<ByteSequence> cols) throws IOException {
  MapIterator src = new MapIterator(source);
  SortedKeyValueIterator<Key,Value> iter = new ChunkCombiner();
  iter.init(src, null, null);
  iter = iter.deepCopy(null);
  iter.seek(new Range(), cols, true);

  TreeMap<Key,Value> seen = new TreeMap<>();

  while (iter.hasTop()) {
    assertFalse("already contains " + iter.getTopKey(), seen.containsKey(iter.getTopKey()));
    seen.put(new Key(iter.getTopKey()), new Value(iter.getTopValue()));

    if (reseek)
      iter.seek(new Range(iter.getTopKey().followingKey(PartialKey.ROW_COLFAM_COLQUAL), true, null, true), cols, true);
    else
      iter.next();
  }

  assertEquals(result, seen);
}
 
开发者ID:apache,项目名称:accumulo-examples,代码行数:22,代码来源:ChunkCombinerTest.java

示例5: seek

import org.apache.accumulo.core.data.PartialKey; //导入依赖的package包/类
@Override
public void seek(final Range range, final Collection<ByteSequence> columnFamilies, final boolean inclusive)
        throws IOException {
    // do not want to seek to the middle of a value that should be
    // combined...

    final Range seekRange = IteratorUtil.maximizeStartKeyTimeStamp(range);

    super.seek(seekRange, columnFamilies, inclusive);
    findTop();

    if (null != range.getStartKey()) {
        while (hasTop() && getTopKey().equals(range.getStartKey(), PartialKey.ROW_COLFAM)
                && getTopKey().getTimestamp() > range.getStartKey().getTimestamp()) {
            // The value has a more recent time stamp, so pass it up
            next();
        }

        while (hasTop() && range.beforeStartKey(getTopKey())) {
            next();
        }
    }
}
 
开发者ID:gchq,项目名称:Gaffer,代码行数:24,代码来源:CoreKeyGroupByCombiner.java

示例6: skipToTimestamp

import org.apache.accumulo.core.data.PartialKey; //导入依赖的package包/类
public void skipToTimestamp(Key curCol, long timestamp) throws IOException {
  source.next();
  int count = 0;
  while (source.hasTop()
      && curCol.equals(source.getTopKey(), PartialKey.ROW_COLFAM_COLQUAL_COLVIS)
      && timestamp < source.getTopKey().getTimestamp()) {
    if (count == 10 && shouldSeek()) {
      // seek to prefix
      Key seekKey = new Key(curCol);
      seekKey.setTimestamp(timestamp);
      Range newRange = new Range(seekKey, true, range.getEndKey(), range.isEndKeyInclusive());
      seek(newRange);
      break;
    }
    source.next();
    count++;
  }
}
 
开发者ID:apache,项目名称:fluo,代码行数:19,代码来源:TimestampSkippingIterator.java

示例7: skipColumn

import org.apache.accumulo.core.data.PartialKey; //导入依赖的package包/类
public void skipColumn(Key curCol) throws IOException {
  source.next();
  int count = 0;
  while (source.hasTop()
      && curCol.equals(source.getTopKey(), PartialKey.ROW_COLFAM_COLQUAL_COLVIS)) {
    if (count == 10) {
      Key seekKey = curCol.followingKey(PartialKey.ROW_COLFAM_COLQUAL_COLVIS);
      Range newRange;
      if (range.afterEndKey(seekKey)) {
        // this range will force source.hasTop() to return false, because nothing can exist in the
        // range.
        newRange = new Range(range.getEndKey(), true, range.getEndKey(), false);
      } else {
        newRange = new Range(seekKey, true, range.getEndKey(), range.isEndKeyInclusive());
      }
      seek(newRange);
      break;
    }
    source.next();
    count++;
  }
}
 
开发者ID:apache,项目名称:fluo,代码行数:23,代码来源:TimestampSkippingIterator.java

示例8: skipRowCol

import org.apache.accumulo.core.data.PartialKey; //导入依赖的package包/类
private void skipRowCol(PushbackIterator source, Key key) throws IOException {
  int count = 0;
  while (source.hasTop()
      && source.getTopKey().equals(key, PartialKey.ROW_COLFAM_COLQUAL_COLVIS)) {
    if (count == 10) {
      Key nextKey = key.followingKey(PartialKey.ROW_COLFAM_COLQUAL_COLVIS);
      if (!seekRange.afterEndKey(nextKey)) {
        seekRange =
            new Range(nextKey, true, seekRange.getEndKey(), seekRange.isEndKeyInclusive());
        source.seek(seekRange, colFams, inclusive);
        break;
      }
    }
    source.next();
    count++;
  }
}
 
开发者ID:apache,项目名称:fluo,代码行数:18,代码来源:NotificationIterator.java

示例9: consumeData

import org.apache.accumulo.core.data.PartialKey; //导入依赖的package包/类
/**
 * @return true when all data columns in current column were consumed
 */
private boolean consumeData() throws IOException {
  while (source.hasTop()
      && curCol.equals(source.getTopKey(), PartialKey.ROW_COLFAM_COLQUAL_COLVIS)) {
    long colType = source.getTopKey().getTimestamp() & ColumnConstants.PREFIX_MASK;
    long ts = source.getTopKey().getTimestamp() & ColumnConstants.TIMESTAMP_MASK;

    if (colType == ColumnConstants.DATA_PREFIX) {
      if (ts >= truncationTime && !rolledback.contains(ts)) {
        return false;
      }
    } else {
      // TODO check if its a notify
      return false;
    }

    source.next();
  }

  return true;
}
 
开发者ID:apache,项目名称:fluo,代码行数:24,代码来源:GarbageCollectionIterator.java

示例10: seek

import org.apache.accumulo.core.data.PartialKey; //导入依赖的package包/类
@Override
public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException {
    topKey = null;
    topValue = null;

    Key sk = range.getStartKey();

    if (sk != null && sk.getColumnFamilyData().length() == 0 && sk.getColumnQualifierData().length() == 0 && sk.getColumnVisibilityData().length() == 0
        && sk.getTimestamp() == Long.MAX_VALUE && !range.isStartKeyInclusive()) {
        // assuming that we are seeking using a key previously returned by this iterator
        // therefore go to the next row
        Key followingRowKey = sk.followingKey(PartialKey.ROW);
        if (range.getEndKey() != null && followingRowKey.compareTo(range.getEndKey()) > 0)
            return;

        range = new Range(sk.followingKey(PartialKey.ROW), true, range.getEndKey(), range.isEndKeyInclusive());
    }

    sourceIter.seek(range, columnFamilies, inclusive);
    prepKeys();
}
 
开发者ID:calrissian,项目名称:accumulo-recipes,代码行数:22,代码来源:WholeColumnFamilyIterator.java

示例11: seek

import org.apache.accumulo.core.data.PartialKey; //导入依赖的package包/类
@Override
public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive) throws IOException {
    topKey = null;
    topValue = null;

    Key sk = range.getStartKey();

    if (sk != null && sk.getColumnFamilyData().length() == 0 && sk.getColumnQualifierData().length() == 0 && sk.getColumnVisibilityData().length() == 0
            && sk.getTimestamp() == Long.MAX_VALUE && !range.isStartKeyInclusive()) {
        // assuming that we are seeking using a key previously returned by this iterator
        // therefore go to the next row
        Key followingRowKey = sk.followingKey(PartialKey.ROW);
        if (range.getEndKey() != null && followingRowKey.compareTo(range.getEndKey()) > 0)
            return;

        range = new Range(sk.followingKey(PartialKey.ROW), true, range.getEndKey(), range.isEndKeyInclusive());
    }

    sourceIter.seek(range, columnFamilies, inclusive);
    prepKeys();
}
 
开发者ID:calrissian,项目名称:accumulo-recipes,代码行数:22,代码来源:EdgeGroupingIterator.java

示例12: next

import org.apache.accumulo.core.data.PartialKey; //导入依赖的package包/类
@Override
public Entry<Key,Value> next() {
  unprocessedEntry = null;

  // Get the next signature.
  Entry<Key,Value> entry = valueIterator.next();
  Entry<Key,Value> signature = bufferedSignatures.get(entry.getKey());
  if (signature == null) {
    while (true) {
      if (!signatureIterator.hasNext()) {
        throw new SignatureException("no signature found");
      }

      signature = signatureIterator.next();

      // Timestamps might be slightly inconsistent, so don't include them in the compare. This requires that both of these tables be versioned.
      // TODO: Check that the tables are versioned, and if not throw an exception.
      int cmp = entry.getKey().compareTo(signature.getKey(), PartialKey.ROW_COLFAM_COLQUAL_COLVIS);

      if (cmp == 0) { // Found the signature
        break;
      } else if (cmp < 0) { // Entry is before the next signature.
        if (inOrder) {
          throw new SignatureException("no signature found for entry");
        } else {
          bufferedSignatures.put(signature.getKey(), signature);
        }
      } else { // Entry is after the next signature.
        if (!inOrder) {
          bufferedSignatures.put(signature.getKey(), signature);
        }
      }
    }
  }

  Entry<Key,Value> processedEntry = verifier.verify(entry, signature);
  unprocessedEntry = entry;
  return processedEntry;
}
 
开发者ID:mit-ll,项目名称:PACE,代码行数:40,代码来源:SignedExternalScannerIterator.java

示例13: getNextRow

import org.apache.accumulo.core.data.PartialKey; //导入依赖的package包/类
private Text getNextRow() throws IOException {
  if (log.isDebugEnabled()) {
    log.debug("getNextRow()");
  }
  Key fakeKey = new Key(source.getTopKey().followingKey(PartialKey.ROW));
  Range fakeRange = new Range(fakeKey, fakeKey);
  source.seek(fakeRange, EMPTY_COL_FAMS, false);
  if (source.hasTop()) {
    return source.getTopKey().getRow();
  } else {
    return null;
  }
}
 
开发者ID:apache,项目名称:accumulo-wikisearch,代码行数:14,代码来源:UniqFieldNameValueIterator.java

示例14: getVerticesInRange

import org.apache.accumulo.core.data.PartialKey; //导入依赖的package包/类
private CloseableIterable<Vertex> getVerticesInRange(
        Span trace,
        String startId,
        String endId,
        EnumSet<FetchHint> fetchHints,
        Long timestamp,
        final Authorizations authorizations
) throws VertexiumException {
    trace.data("startId", startId);
    trace.data("endId", endId);
    if (Trace.isTracing() && timestamp != null) {
        trace.data("timestamp", Long.toString(timestamp));
    }
    traceDataFetchHints(trace, fetchHints);

    final Key startKey;
    if (startId == null) {
        startKey = null;
    } else {
        startKey = new Key(startId);
    }

    final Key endKey;
    if (endId == null) {
        endKey = null;
    } else {
        endKey = new Key(endId).followingKey(PartialKey.ROW);
    }

    org.apache.accumulo.core.data.Range range = new org.apache.accumulo.core.data.Range(startKey, endKey);
    return getVerticesInRange(trace, range, fetchHints, timestamp, authorizations);
}
 
开发者ID:visallo,项目名称:vertexium,代码行数:33,代码来源:AccumuloGraph.java

示例15: getEdgesInRange

import org.apache.accumulo.core.data.PartialKey; //导入依赖的package包/类
protected CloseableIterable<Edge> getEdgesInRange(
        final Span trace,
        String startId,
        String endId,
        final EnumSet<FetchHint> fetchHints,
        final Long timestamp,
        final Authorizations authorizations
) throws VertexiumException {
    trace.data("startId", startId);
    trace.data("endId", endId);
    if (Trace.isTracing() && timestamp != null) {
        trace.data("timestamp", Long.toString(timestamp));
    }
    traceDataFetchHints(trace, fetchHints);

    final Key startKey;
    if (startId == null) {
        startKey = null;
    } else {
        startKey = new Key(startId);
    }

    final Key endKey;
    if (endId == null) {
        endKey = null;
    } else {
        endKey = new Key(endId).followingKey(PartialKey.ROW);
    }

    org.apache.accumulo.core.data.Range range = new org.apache.accumulo.core.data.Range(startKey, endKey);
    return getEdgesInRange(trace, range, fetchHints, timestamp, authorizations);
}
 
开发者ID:visallo,项目名称:vertexium,代码行数:33,代码来源:AccumuloGraph.java


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