All Downloads are FREE. Search and download functionalities are using the official Maven repository.

redis.clients.jedis.resps.StreamFullInfo Maven / Gradle / Ivy

The newest version!
package redis.clients.jedis.resps;

import redis.clients.jedis.StreamEntryID;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * This class holds information about a stream info with command {@code xinfo stream mystream full}.
 * They can be accessed via getters. There is also {@link StreamFullInfo#getStreamFullInfo()} method
 * that returns a generic {@link Map} in case where more info are returned from the server.
 */
public class StreamFullInfo implements Serializable {

  public static final String LENGTH = "length";
  public static final String RADIX_TREE_KEYS = "radix-tree-keys";
  public static final String RADIX_TREE_NODES = "radix-tree-nodes";
  public static final String GROUPS = "groups";
  public static final String LAST_GENERATED_ID = "last-generated-id";
  public static final String ENTRIES = "entries";

  private final long length;
  private final long radixTreeKeys;
  private final long radixTreeNodes;
  private final List groups;
  private final StreamEntryID lastGeneratedId;
  private final List entries;
  private final Map streamFullInfo;

  /**
   * @param map contains key-value pairs with stream info
   */
  @SuppressWarnings("unchecked")
  public StreamFullInfo(Map map) {

    streamFullInfo = map;
    length = (Long) map.get(LENGTH);
    radixTreeKeys = (Long) map.get(RADIX_TREE_KEYS);
    radixTreeNodes = (Long) map.get(RADIX_TREE_NODES);
    groups = (List) map.get(GROUPS);
    lastGeneratedId = (StreamEntryID) map.get(LAST_GENERATED_ID);
    entries = (List) map.get(ENTRIES);

  }

  public long getLength() {
    return length;
  }

  public long getRadixTreeKeys() {
    return radixTreeKeys;
  }

  public long getRadixTreeNodes() {
    return radixTreeNodes;
  }

  public List getGroups() {
    return groups;
  }

  public StreamEntryID getLastGeneratedId() {
    return lastGeneratedId;
  }

  public List getEntries() {
    return entries;
  }

  public Map getStreamFullInfo() {
    return streamFullInfo;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy