public List<KVEntry> singleRegionScan(final byte[] startKey, final byte[] endKey, final int limit,
                                          final boolean readOnlySafe, final boolean returnValue) {
        checkState();
        final byte[] realStartKey = BytesUtil.nullToEmpty(startKey);
        if (endKey != null) {
            Requires.requireTrue(BytesUtil.compare(realStartKey, endKey) < 0, "startKey must < endKey");
        }
        Requires.requireTrue(limit > 0, "limit must > 0");
        final CompletableFuture<List<KVEntry>> future = new CompletableFuture<>();
        internalSingleRegionScan(realStartKey, endKey, limit, readOnlySafe, returnValue, future, this.failoverRetries,
            null, this.onlyLeaderRead);
        return FutureHelper.get(future, this.futureTimeoutMillis);
    }
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/>
jraft-rheakv/rheakv-core/src/main/java/com/alipay/sofa/jraft/rhea/client/DefaultRheaKVStore.java