@Override public int compare(final Bytes cacheKey, final Bytes storeKey) { return cacheKey.compareTo(storeKey); } }
@Override public int compareTo(final BufferKey o) { // ordering of keys within a time uses hashCode. final int timeComparison = Long.compare(time, o.time); return timeComparison == 0 ? key.compareTo(o.key) : timeComparison; } }
@Override public boolean hasNext(final KeyValueIterator<Bytes, ?> iterator) { while (iterator.hasNext()) { final Bytes bytes = iterator.peekNextKey(); final Bytes keyBytes = Bytes.wrap(WindowKeySchema.extractStoreKeyBytes(bytes.get())); final long time = WindowKeySchema.extractStoreTimestamp(bytes.get()); if ((binaryKeyFrom == null || keyBytes.compareTo(binaryKeyFrom) >= 0) && (binaryKeyTo == null || keyBytes.compareTo(binaryKeyTo) <= 0) && time >= from && time <= to) { return true; } iterator.next(); } return false; } };
@Override public boolean hasNext(final KeyValueIterator<Bytes, ?> iterator) { while (iterator.hasNext()) { final Bytes bytes = iterator.peekNextKey(); final Windowed<Bytes> windowedKey = SessionKeySchema.from(bytes); if ((binaryKeyFrom == null || windowedKey.key().compareTo(binaryKeyFrom) >= 0) && (binaryKeyTo == null || windowedKey.key().compareTo(binaryKeyTo) <= 0) && windowedKey.window().end() >= from && windowedKey.window().start() <= to) { return true; } iterator.next(); } return false; } };