Examples of LabelCounters


Examples of com.elasticinbox.core.model.LabelCounters

  {
    // reset all counters (since delete won't work in most cases)
    // see: http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/possible-coming-back-to-life-bug-with-counters-tp6464338p6475427.html
    Map<Integer, LabelCounters> counters = getAll(mailbox);
    for (Integer labelId : counters.keySet()) {
      LabelCounters labelCounters = counters.get(labelId);
      subtract(mutator, mailbox, labelId, labelCounters);
    }

    // delete all label counters
    mutator.delete(mailbox, CF_COUNTERS, null, strSe);
View Full Code Here

Examples of com.elasticinbox.core.model.LabelCounters

      final String mailbox, final List<HCounterColumn<Composite>> columnList)
  {
    Map<Integer, LabelCounters> result =
        new HashMap<Integer, LabelCounters>(LabelConstants.MAX_RESERVED_LABEL_ID);

    LabelCounters labelCounters = new LabelCounters();
    int prevLabelId = 0; // remember previous labelid which is always start form 0

    for (HCounterColumn<Composite> c : columnList)
    {
      int labelId = Integer.parseInt(c.getName().get(1, strSe));
      char subtype = c.getName().get(2, strSe).charAt(0);

      // since columns are ordered by labels, we can
      // flush label counters to result map as we traverse
      if (prevLabelId != labelId) {
        logger.debug("Fetched counters for label {} with {}", prevLabelId, labelCounters);
        result.put(prevLabelId, labelCounters);
        labelCounters = new LabelCounters();
        prevLabelId = labelId;
      }

      switch (subtype) {
      case CN_SUBTYPE_BYTES:
        labelCounters.setTotalBytes(c.getValue());
        break;
      case CN_SUBTYPE_MESSAGES:
        labelCounters.setTotalMessages(c.getValue());
        break;
      case CN_SUBTYPE_UNREAD:
        labelCounters.setUnreadMessages(c.getValue());
        break;
      }

      if (c.getValue() < 0) {
        logger.warn("Negative counter value found for label {}/{}: ", mailbox, labelId);
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.