Package org.iq80.leveldb.util

Examples of org.iq80.leveldb.util.InternalTableIterator.seek()


        DBIterator it = levelDBFile.getDb().iterator();

        String prefix = repositoryName + '\0';
        int count = 0;
        try {
            for (it.seek(keyBuilder(repositoryName, "")); it.hasNext(); it.next()) {
                if (!asString(it.peekNext().getKey()).startsWith(prefix)) {
                    break;
                }
                count++;
            }
View Full Code Here


    Long toHoursSince1970 = date.getTime() / (15000 * 240);
       
        List<String> keysToDeleteList = new ArrayList<>();
       
        DBIterator iterator = db.iterator();
    iterator.seek(bytes(liveStatsBucketKey + accountName));
    while (iterator.hasNext() && asString(iterator.peekNext().getKey()).startsWith(liveStatsBucketKey + accountName)) {
      String key = asString(iterator.peekNext().getKey());
      BasicMetricHour metricHour = gson.fromJson(asString(iterator.next().getValue()), BasicMetricHour.class);
      if (metricHour.getHoursSince1970() <= toHoursSince1970) {
        keysToDeleteList.add(key);
View Full Code Here

  @Override
  public void deleteLiveStatisticsBetween(String guiPath, String accountName, Long fromTimeperiod, Long toTimeperiod) {
        List<String> keysToDeleteList = new ArrayList<>();
       
        DBIterator iterator = db.iterator();
    iterator.seek(bytes(liveStatsBucketKey + accountName));
    while (iterator.hasNext() && asString(iterator.peekNext().getKey()).startsWith(liveStatsBucketKey + accountName)) {
      String key = asString(iterator.peekNext().getKey());
      BasicMetricHour metricHour = gson.fromJson(asString(iterator.next().getValue()), BasicMetricHour.class);
      if (metricHour.getHoursSince1970() >= fromTimeperiod && metricHour.getHoursSince1970() <= toTimeperiod) {
        keysToDeleteList.add(key);
View Full Code Here

  @Override
  public List<Statistics> getTreeMenu(String accountName) {
    List<Statistics> statList = new ArrayList<>();
   
    DBIterator iterator = db.iterator();
    iterator.seek(bytes(statsBucketKey + accountName));
    while (iterator.hasNext() && asString(iterator.peekNext().getKey()).startsWith(statsBucketKey + accountName)) {
      BasicStatistics stat = gson.fromJson(asString(iterator.next().getValue()), BasicStatistics.class);
      statList.add(stat);
    }
   
View Full Code Here

  public void addAccountNamesToNewQueue(List<String> accountNameList) {
    Hashtable<String, AlertEvaluation> alertEvaluationHash = new Hashtable<>();

    //Fetch any account already in the new queue and add the new AlertEvaluations to the new queue
    DBIterator iterator = db.iterator();
    iterator.seek(bytes(alertEvaluationQueueBucketKey + ";new"));
    while (iterator.hasNext() && asString(iterator.peekNext().getKey()).startsWith(alertEvaluationQueueBucketKey + ";new")) {
      BasicAlertEvaluation alertEvaluation = new Gson().fromJson(asString(iterator.next().getValue()), BasicAlertEvaluation.class);
      alertEvaluationHash.put(alertEvaluation.getAccountName(), alertEvaluation);
    }
   
View Full Code Here

  @Override
  public synchronized String getNextAccountToEvaluateAndMarkAsEvaluating() {
    BasicAlertEvaluation nextAccount = null;
   
    DBIterator iterator = db.iterator();
    iterator.seek(bytes(alertEvaluationQueueBucketKey + ";new"));
    while (iterator.hasNext() && asString(iterator.peekNext().getKey()).startsWith(alertEvaluationQueueBucketKey + ";new")) {
      BasicAlertEvaluation alertEvaluation = new Gson().fromJson(asString(iterator.next().getValue()), BasicAlertEvaluation.class);
      nextAccount = alertEvaluation;
      break;
    }
View Full Code Here

  @Override
  public List<GroupedStatistics> getGroupedStatistics(String accountName) {
    List<GroupedStatistics> groupedStatsList = new ArrayList<>();
   
    DBIterator iterator = db.iterator();
    iterator.seek(bytes(groupedStatsBucketKey + accountName));
    while (iterator.hasNext() && asString(iterator.peekNext().getKey()).startsWith(groupedStatsBucketKey + accountName)) {
      BasicGroupedStatistics groupedStat = gson.fromJson(asString(iterator.next().getValue()), BasicGroupedStatistics.class);
      groupedStatsList.add(groupedStat);
    }
   
View Full Code Here

  @Override
  public List<AlertRecipient> getAlertRecipients(String accountName) {
    List<AlertRecipient> alertRecipientList = new ArrayList<>();

    DBIterator iterator = db.iterator();
    iterator.seek(bytes(alertRecipientBucketKey + accountName));
    while (iterator.hasNext() && asString(iterator.peekNext().getKey()).startsWith(alertRecipientBucketKey + accountName)) {
      BasicAlertRecipient alert = gson.fromJson(asString(iterator.next().getValue()), BasicAlertRecipient.class);
      alertRecipientList.add(alert);
    }
View Full Code Here

  @Override
  public List<Account> getAccounts() {
    List<Account> accountList = new ArrayList<>();
   
    DBIterator iterator = db.iterator();
    iterator.seek(bytes(accountBucketKey));
    while (iterator.hasNext() && asString(iterator.peekNext().getKey()).startsWith(accountBucketKey)) {
      accountList.add(gson.fromJson(asString(iterator.next().getValue()), BasicAccount.class));
    }
    return accountList;
  }
View Full Code Here

  public List<User> getUsers(String username) {
    logger.info("LevelDB: Getting Users with username: " + username);
    List<User> userList = new ArrayList<>();
   
    DBIterator iterator = db.iterator();
    iterator.seek(bytes(userBucketKey + ";" + username.replace("@", "__")));
    while (iterator.hasNext() && asString(iterator.peekNext().getKey()).startsWith(userBucketKey)) {
      BasicUser user = gson.fromJson(asString(iterator.next().getValue()), BasicUser.class);
      logger.info("Got User: " + user.getUserName() + " with role: " + user.getUserRole());
      if (user.getUserName().equals(username)) {
        userList.add(user);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.