com.thinkaurelius.titan.diskstorage.keycolumnvalue.KeySliceQuery.getKey()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(8.7k)|赞(0)|评价(0)|浏览(98)

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

KeySliceQuery.getKey介绍

暂无

代码示例

代码示例来源:origin: thinkaurelius/titan

private boolean isExpired(final KeySliceQuery query) {
  Long until = expiredKeys.get(query.getKey());
  if (until==null) return false;
  if (isBeyondExpirationTime(until)) {
    expiredKeys.remove(query.getKey(),until);
    return false;
  }
  //We suffer a cache miss, hence decrease the count down
  penaltyCountdown.countDown();
  return true;
}

代码示例来源:origin: thinkaurelius/titan

@Override
public EntryList getSlice(KeySliceQuery query, StoreTransaction txh) throws BackendException {
  Map<StaticBuffer, EntryList> result = getNamesSlice(query.getKey(), query, txh);
  return Iterables.getOnlyElement(result.values(),EntryList.EMPTY_LIST);
}

代码示例来源:origin: thinkaurelius/titan

@Override
public EntryList getSlice(KeySliceQuery query, StoreTransaction txh) throws BackendException {
  Map<StaticBuffer, EntryList> result = getHelper(Arrays.asList(query.getKey()), getFilter(query));
  return Iterables.getOnlyElement(result.values(), EntryList.EMPTY_LIST);
}

代码示例来源:origin: thinkaurelius/titan

/**
 * Call Cassandra's Thrift get_slice() method.
 * <p/>
 * When columnEnd equals columnStart and either startInclusive
 * or endInclusive is false (or both are false), then this
 * method returns an empty list without making any Thrift calls.
 * <p/>
 * If columnEnd = columnStart + 1, and both startInclusive and
 * startExclusive are false, then the arguments effectively form
 * an empty interval.  In this case, as in the one previous,
 * an empty list is returned.  However, it may not necessarily
 * be handled efficiently; a Thrift call might still be made
 * before returning the empty list.
 *
 * @throws com.thinkaurelius.titan.diskstorage.BackendException
 *          when columnEnd < columnStart
 */
@Override
public EntryList getSlice(KeySliceQuery query, StoreTransaction txh) throws BackendException {
  Map<StaticBuffer, EntryList> result = getNamesSlice(query.getKey(), query, txh);
  return Iterables.getOnlyElement(result.values(), EntryList.EMPTY_LIST);
}

代码示例来源:origin: thinkaurelius/titan

@Override
public void run() {
  while (true) {
    if (stop) return;
    try {
      penaltyCountdown.await();
    } catch (InterruptedException e) {
      if (stop) return;
      else throw new RuntimeException("Cleanup thread got interrupted",e);
    }
    //Do clean up work by invalidating all entries for expired keys
    HashMap<StaticBuffer,Long> expiredKeysCopy = new HashMap<StaticBuffer,Long>(expiredKeys.size());
    for (Map.Entry<StaticBuffer,Long> expKey : expiredKeys.entrySet()) {
      if (isBeyondExpirationTime(expKey.getValue()))
        expiredKeys.remove(expKey.getKey(), expKey.getValue());
      else if (getAge(expKey.getValue())>= invalidationGracePeriodMS)
        expiredKeysCopy.put(expKey.getKey(),expKey.getValue());
    }
    for (KeySliceQuery ksq : cache.asMap().keySet()) {
      if (expiredKeysCopy.containsKey(ksq.getKey())) cache.invalidate(ksq);
    }
    penaltyCountdown = new CountDownLatch(PENALTY_THRESHOLD);
    for (Map.Entry<StaticBuffer,Long> expKey : expiredKeysCopy.entrySet()) {
      expiredKeys.remove(expKey.getKey(),expKey.getValue());
    }
  }
}

代码示例来源:origin: thinkaurelius/titan

@Override
public EntryList getSlice(KeySliceQuery query, StoreTransaction txh) throws BackendException {
  ColumnValueStore cvs = kcv.get(query.getKey());
  if (cvs == null) return EntryList.EMPTY_LIST;
  else return cvs.getSlice(query, txh);
}

代码示例来源:origin: thinkaurelius/titan

final KVQuery convertQuery(final KeySliceQuery query) {
  Predicate<StaticBuffer> filter = Predicates.alwaysTrue();
  if (!hasFixedKeyLength()) filter = new Predicate<StaticBuffer>() {
    @Override
    public boolean apply(@Nullable StaticBuffer keyAndColumn) {
      return equalKey(keyAndColumn, query.getKey());
    }
  };
  return new KVQuery(
      concatenatePrefix(query.getKey(), query.getSliceStart()),
      concatenatePrefix(query.getKey(), query.getSliceEnd()),
      filter,query.getLimit());
}

代码示例来源:origin: thinkaurelius/titan

SliceQueryFilter sqf = new SliceQueryFilter(startComposite, endComposite,
    false, query.getLimit() + (query.hasLimit()?1:0));
ReadCommand sliceCmd = new SliceFromReadCommand(keyspace, query.getKey().asByteBuffer(), columnFamily, nowMillis, sqf);

代码示例来源:origin: org.hawkular.titan/titan-core

private boolean isExpired(final KeySliceQuery query) {
  Long until = expiredKeys.get(query.getKey());
  if (until==null) return false;
  if (isBeyondExpirationTime(until)) {
    expiredKeys.remove(query.getKey(),until);
    return false;
  }
  //We suffer a cache miss, hence decrease the count down
  penaltyCountdown.countDown();
  return true;
}

代码示例来源:origin: com.thinkaurelius.titan/titan-core

private boolean isExpired(final KeySliceQuery query) {
  Long until = expiredKeys.get(query.getKey());
  if (until==null) return false;
  if (isBeyondExpirationTime(until)) {
    expiredKeys.remove(query.getKey(),until);
    return false;
  }
  //We suffer a cache miss, hence decrease the count down
  penaltyCountdown.countDown();
  return true;
}

代码示例来源:origin: org.hawkular.titan/titan-cassandra

@Override
public EntryList getSlice(KeySliceQuery query, StoreTransaction txh) throws BackendException {
  Map<StaticBuffer, EntryList> result = getNamesSlice(query.getKey(), query, txh);
  return Iterables.getOnlyElement(result.values(),EntryList.EMPTY_LIST);
}

代码示例来源:origin: com.thinkaurelius.titan/titan-cassandra

@Override
public EntryList getSlice(KeySliceQuery query, StoreTransaction txh) throws BackendException {
  Map<StaticBuffer, EntryList> result = getNamesSlice(query.getKey(), query, txh);
  return Iterables.getOnlyElement(result.values(),EntryList.EMPTY_LIST);
}

代码示例来源:origin: com.thinkaurelius.titan/titan-hbase-jre6

@Override
public List<Entry> getSlice(KeySliceQuery query, StoreTransaction txh) throws StorageException {
  List<List<Entry>> result = getHelper(Arrays.asList(query.getKey()), getFilter(query));
  return (result.isEmpty()) ? Collections.<Entry>emptyList() : result.get(0);
}

代码示例来源:origin: org.apache.atlas/atlas-titan

@Override
public EntryList getSlice(KeySliceQuery query, StoreTransaction txh) throws BackendException {
  Map<StaticBuffer, EntryList> result = getHelper(Arrays.asList(query.getKey()), getFilter(query));
  return Iterables.getOnlyElement(result.values(), EntryList.EMPTY_LIST);
}

代码示例来源:origin: apache/incubator-atlas

@Override
public EntryList getSlice(KeySliceQuery query, StoreTransaction txh) throws BackendException {
  Map<StaticBuffer, EntryList> result = getHelper(Arrays.asList(query.getKey()), getFilter(query));
  return Iterables.getOnlyElement(result.values(), EntryList.EMPTY_LIST);
}

代码示例来源:origin: org.hawkular.titan/titan-cassandra

/**
 * Call Cassandra's Thrift get_slice() method.
 * <p/>
 * When columnEnd equals columnStart and either startInclusive
 * or endInclusive is false (or both are false), then this
 * method returns an empty list without making any Thrift calls.
 * <p/>
 * If columnEnd = columnStart + 1, and both startInclusive and
 * startExclusive are false, then the arguments effectively form
 * an empty interval.  In this case, as in the one previous,
 * an empty list is returned.  However, it may not necessarily
 * be handled efficiently; a Thrift call might still be made
 * before returning the empty list.
 *
 * @throws com.thinkaurelius.titan.diskstorage.BackendException
 *          when columnEnd < columnStart
 */
@Override
public EntryList getSlice(KeySliceQuery query, StoreTransaction txh) throws BackendException {
  Map<StaticBuffer, EntryList> result = getNamesSlice(query.getKey(), query, txh);
  return Iterables.getOnlyElement(result.values(), EntryList.EMPTY_LIST);
}

代码示例来源:origin: com.thinkaurelius.titan/titan-core

@Override
public EntryList getSlice(KeySliceQuery query, StoreTransaction txh) throws BackendException {
  ColumnValueStore cvs = kcv.get(query.getKey());
  if (cvs == null) return EntryList.EMPTY_LIST;
  else return cvs.getSlice(query, txh);
}

代码示例来源:origin: org.hawkular.titan/titan-core

@Override
public EntryList getSlice(KeySliceQuery query, StoreTransaction txh) throws BackendException {
  ColumnValueStore cvs = kcv.get(query.getKey());
  if (cvs == null) return EntryList.EMPTY_LIST;
  else return cvs.getSlice(query, txh);
}

代码示例来源:origin: com.thinkaurelius.titan/titan-core

final KVQuery convertQuery(final KeySliceQuery query) {
  Predicate<StaticBuffer> filter = Predicates.alwaysTrue();
  if (!hasFixedKeyLength()) filter = new Predicate<StaticBuffer>() {
    @Override
    public boolean apply(@Nullable StaticBuffer keyAndColumn) {
      return equalKey(keyAndColumn, query.getKey());
    }
  };
  return new KVQuery(
      concatenatePrefix(query.getKey(), query.getSliceStart()),
      concatenatePrefix(query.getKey(), query.getSliceEnd()),
      filter,query.getLimit());
}

代码示例来源:origin: org.hawkular.titan/titan-core

final KVQuery convertQuery(final KeySliceQuery query) {
  Predicate<StaticBuffer> filter = Predicates.alwaysTrue();
  if (!hasFixedKeyLength()) filter = new Predicate<StaticBuffer>() {
    @Override
    public boolean apply(@Nullable StaticBuffer keyAndColumn) {
      return equalKey(keyAndColumn, query.getKey());
    }
  };
  return new KVQuery(
      concatenatePrefix(query.getKey(), query.getSliceStart()),
      concatenatePrefix(query.getKey(), query.getSliceEnd()),
      filter,query.getLimit());
}

相关文章