private boolean fetchnextKey() {
      if (this.innerIterator.isValid()) {
        byte[] keyEntry = this.innerIterator.key();

        // Check if the next key returned starts with the expected
        // prefix
        if (StoreBinaryFormat.extractPartition(keyEntry) != partitionId) {
          return false;
        }

        this.innerIterator.next();
        cache = new ByteArray(StoreBinaryFormat.extractKey(keyEntry));
        return true;
      }
      return false;
    }
    protected boolean makeMore() {
      if (innerIterator.isValid()) {
        byte[] keyEntry = innerIterator.key();

        // Check if the next key returned starts with the expected
        // prefix
        if (StoreBinaryFormat.extractPartition(keyEntry) != partitionId) {
          return false;
        }
        byte[] valueEntry = innerIterator.value();
        innerIterator.next();
        ByteArray key = new ByteArray(StoreBinaryFormat.extractKey(keyEntry));
        for (Versioned<byte[]> val : StoreBinaryFormat.fromByteArray(valueEntry)) {
          cache.add(new Pair<ByteArray, Versioned<byte[]>>(key, val));
        }
        return true;
      }
      return false;
    }
    public RocksdbEntriesIterator(RocksIterator innerIterator, int partition) {
      this.innerIterator = innerIterator;

      this.partitionId = partition;

      // Caller of the RocksIterator should seek it before the first use.
      // seek to the prefix specified
      this.innerIterator.seek(StoreBinaryFormat.makePartitionKey(partition));

      cache = new ArrayList<Pair<ByteArray, Versioned<byte[]>>>();
    }
    public RocksdbKeysIterator(RocksIterator innerIterator, int partition) {
      this.innerIterator = innerIterator;

      this.partitionId = partition;

      // Caller of the RocksIterator should seek it to the prefix before
      // the first use.
      this.innerIterator.seek(StoreBinaryFormat.makePartitionKey(partition));

      cache = null;
    }
 private ByteArray validateAndConstructKey(ByteArray key) {
   StoreUtils.assertValidKey(key);
   int partition = routingStrategy.getMasterPartition(key.get());
   ByteArray prefixedKey = new ByteArray(StoreBinaryFormat.makePrefixedKey(key.get(), partition));
   return prefixedKey;
 }