Skip to content

Instantly share code, notes, and snippets.

@arjunsk
Created May 12, 2022 19:00
Show Gist options
  • Save arjunsk/315a6239a9a3016746dde8e645b2f64e to your computer and use it in GitHub Desktop.
Save arjunsk/315a6239a9a3016746dde8e645b2f64e to your computer and use it in GitHub Desktop.
/**
* Returns a heap-allocated iterator over the contents of the
* database.
* <p>
* Caller should close the iterator when it is no longer needed.
* The returned iterator should be closed before this db is closed.
* <p>
* <pre>
* KVIterator it = unsafeLocalIterator();
* try {
* // do something
* } finally {
* it.close();
* }
* <pre/>
*/
public KVIterator unsafeLocalIterator() {
checkState();
if (this.pdClient instanceof RemotePlacementDriverClient) {
throw new UnsupportedOperationException("unsupported operation on multi-region");
}
if (this.storeEngine == null) {
throw new IllegalStateException("current node do not have store engine");
}
return this.storeEngine.getRawKVStore().localIterator();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment