Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

There will also be an implementation for a "raw" version of the RangeQuery, which simply takes the key as a byte array and returns the value as a byte array. The reason why we provide also a raw version is that it simplifies internal query handling since the bytes stores only support raw queries. No type check needed for every query key. Moreover,  we want to have the option to let ksql or any other "user" to handle de/serialization and avoid multiple serialization round-trips during query handling, which is unavoidable in IQv1

Code Block
titleRawRangeQuery
public class RawRangeQuery implements Query<KeyValueIterator<Bytes, byte[]>> {

    private final Optional<Bytes> lower;
    private final Optional<Bytes> upper;

    private RawRangeQuery(final Optional<Bytes> lower, final Optional<Bytes> upper) {
        this.lower = lower;
        this.upper = upper;
    }

    public static RawRangeQuery withRange(final Bytes lower, final Bytes upper) {
        return new RawRangeQuery(Optional.of(lower), Optional.of(upper));
    }

    public static RawRangeQuery withUpperBound(final Bytes upper) {
        return new RawRangeQuery(Optional.empty(), Optional.of(upper));
    }

    public static RawRangeQuery withLowerBound(final Bytes lower) {
        return new RawRangeQuery(Optional.of(lower), Optional.empty());
    }

    public static RawRangeQuery withNoBounds() {
        return new RawRangeQuery(Optional.empty(), Optional.empty());
    }

    public Optional<Bytes> getLowerBound() {
        return lower;
    }

    public Optional<Bytes> getUpperBound() {
        return upper;
    }

...