Examples of DBIterator


Examples of org.iq80.leveldb.DBIterator

  @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);
    }
   
    return statList;
  }
View Full Code Here

Examples of org.iq80.leveldb.DBIterator

  @Override
  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);
    }
   
    //Add only the new AlertEvaluations to the new queue
    List<BasicAlertEvaluation> alertEvaluationsToAdd = new ArrayList<>();
View Full Code Here

Examples of org.iq80.leveldb.DBIterator

  @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;
    }
   
    //Write the new Alert Evaluations to the new queue
View Full Code Here

Examples of org.iq80.leveldb.DBIterator

  @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);
    }
   
    return groupedStatsList;
  }
View Full Code Here

Examples of org.iq80.leveldb.DBIterator

 
  @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);
    }

    return alertRecipientList;
  }
View Full Code Here

Examples of org.iq80.leveldb.DBIterator

 
  @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

Examples of org.iq80.leveldb.DBIterator

  @Override
  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

Examples of org.iq80.leveldb.DBIterator

  @Override
  public List<Alert> getAlerts(String accountName) {
    List<Alert> alertList = new ArrayList<>();

    DBIterator iterator = db.iterator();
    iterator.seek(bytes(alertBucketKey + accountName));
    while (iterator.hasNext() && asString(iterator.peekNext().getKey()).startsWith(alertBucketKey + accountName)) {
      BasicAlert alert = gson.fromJson(asString(iterator.next().getValue()), BasicAlert.class);
      alertList.add(alert);
    }

    return alertList;
  }
View Full Code Here

Examples of org.iq80.leveldb.DBIterator

  @Override
  public List<TriggeredAlert> getTriggeredAlerts(String accountName, Long fromTimeperiod, Long toTimeperiod) {
    List<TriggeredAlert> triggeredAlertList = new ArrayList<>();
   
    DBIterator iterator = db.iterator();
    iterator.seek(bytes(triggeredAlertlertBucketKey + accountName));
    while (iterator.hasNext() && asString(iterator.peekNext().getKey()).startsWith(triggeredAlertlertBucketKey + accountName)) {
      BasicTriggeredAlert triggeredAlert = gson.fromJson(asString(iterator.next().getValue()), BasicTriggeredAlert.class);
      if (triggeredAlert.getTriggeredTimeperiod() >= fromTimeperiod && triggeredAlert.getTriggeredTimeperiod() <= toTimeperiod) {
        triggeredAlertList.add(triggeredAlert);
      }
    }
   
View Full Code Here

Examples of org.iq80.leveldb.DBIterator

  @Override
  public List<TriggeredAlert> getTriggeredAlerts(String alertname, String accountName, Long fromTimeperiod, Long toTimeperiod) {
List<TriggeredAlert> triggeredAlertList = new ArrayList<>();
   
    DBIterator iterator = db.iterator();
    iterator.seek(bytes(triggeredAlertlertBucketKey + accountName + ";" + alertname));
    while (iterator.hasNext() && asString(iterator.peekNext().getKey()).startsWith(triggeredAlertlertBucketKey + accountName + ";" + alertname)) {
      BasicTriggeredAlert triggeredAlert = gson.fromJson(asString(iterator.next().getValue()), BasicTriggeredAlert.class);
      if (triggeredAlert.getTriggeredTimeperiod() >= fromTimeperiod && triggeredAlert.getTriggeredTimeperiod() <= toTimeperiod) {
        triggeredAlertList.add(triggeredAlert);
      }
    }
   
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.