Interface RangeScanConsumer


public interface RangeScanConsumer
Callback used by AsyncOxiaClient.rangeScan(String, String, RangeScanConsumer) to deliver records, errors, and the completion signal for a streaming range scan.

Exactly one of onError(Throwable) or onCompleted() is invoked per scan, and always after the final onNext(GetResult) call. Returning false from onNext stops iteration early; the underlying server stream is cancelled and onCompleted() is invoked once.


 client.rangeScan("a", "z", new RangeScanConsumer() {
     public boolean onNext(GetResult result) {
         process(result);
         return true; // return false to abort iteration early
     }
     public void onError(Throwable t) { log.warn("scan failed", t); }
     public void onCompleted() { log.info("scan finished"); }
 });
 

For a synchronous, iterator-style alternative, see SyncOxiaClient.rangeScan(String, String) which returns a CloseableIterable.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Invoked when the range scan operation completes.
    void
    onError(Throwable throwable)
    Invoked when an error occurs during the range scan operation.
    boolean
    onNext(GetResult result)
    Invoked for each record returned by the range scan operation.
  • Method Details

    • onNext

      boolean onNext(GetResult result)
      Invoked for each record returned by the range scan operation.
      Parameters:
      result - The GetResult for the record.
      Returns:
      true to keep receiving records, false to stop the iteration. When false is returned, the underlying server stream is cancelled, no further onNext(io.oxia.client.api.GetResult) invocations will be made, and onCompleted() will be invoked once.
    • onError

      void onError(Throwable throwable)
      Invoked when an error occurs during the range scan operation.
      Parameters:
      throwable - the exception that occurred.
    • onCompleted

      void onCompleted()
      Invoked when the range scan operation completes.