Versions Compared

Key

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

Table of Contents


Status

Current state: "Under Discussion"

...

Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).

Motivation

Provide an implementation of the Query interface, introduced in KIP-796: Interactive Query v2 , to support range and scan queries

Proposed Changes

The RangeQuery class will be used for both range and scan queries. A scan is performed when no lower and no upper bound is specified

...

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;
    }


Compatibility, Deprecation, and Migration Plan

  • Since this is a completely new set of APIs, no backward compatibility concerns are anticipated. 
  • Since nothing is deprecated in this KIP, users have no need to migrate unless they want to.