Zakelly commented on code in PR #24812: URL: https://github.com/apache/flink/pull/24812#discussion_r1742988791
########## flink-state-backends/flink-statebackend-forst/src/main/java/org/apache/flink/state/forst/ForStDBGetRequest.java: ########## @@ -45,6 +47,12 @@ public abstract class ForStDBGetRequest<K, N, V, R> { this.future = future; } + public void process(RocksDB db) throws IOException, RocksDBException { Review Comment: I suggest a generic interface `ForStDBRequest` defining basic methods for all requests. WDYT? ########## flink-state-backends/flink-statebackend-forst/src/main/java/org/apache/flink/state/forst/ForStDBMapEntryIterRequest.java: ########## @@ -0,0 +1,145 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.state.forst; + +import org.apache.flink.api.common.state.v2.StateIterator; +import org.apache.flink.core.state.InternalStateFuture; +import org.apache.flink.runtime.asyncprocessing.StateRequestHandler; +import org.apache.flink.runtime.asyncprocessing.StateRequestType; + +import org.rocksdb.RocksDB; +import org.rocksdb.RocksIterator; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; + +/** The ForSt {@link ForStDBIterRequest} which returns the entries of a ForStMapState. */ +public class ForStDBMapEntryIterRequest<K, N, UK, UV> extends ForStDBIterRequest<K, N, UK, UV> { + + private final InternalStateFuture<StateIterator<Map.Entry<UK, UV>>> future; + + public ForStDBMapEntryIterRequest( + ContextKey contextKey, + ForStMapState table, + StateRequestHandler stateRequestHandler, + byte[] toSeekBytes, + InternalStateFuture<StateIterator<Map.Entry<UK, UV>>> future) { + super(contextKey, table, stateRequestHandler, toSeekBytes); + this.future = future; + } + + @Override + public void completeStateFutureExceptionally(String message, Throwable ex) { + future.completeExceptionally(message, ex); + } + + @Override + public void process(RocksDB db, int cacheSizeLimit) throws IOException { + try (RocksIterator iter = db.newIterator(table.getColumnFamilyHandle())) { Review Comment: Is it possible we keep and reuse this iterator in the next request? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org