swamirishi commented on code in PR #6182:
URL: https://github.com/apache/ozone/pull/6182#discussion_r1498476434


##########
hadoop-hdds/rocks-native/src/main/java/org/apache/hadoop/hdds/utils/db/managed/ManagedRawSSTFileReader.java:
##########
@@ -0,0 +1,92 @@
+/*
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.hadoop.hdds.utils.db.managed;
+
+import org.apache.hadoop.hdds.utils.NativeLibraryLoader;
+import org.apache.hadoop.hdds.utils.NativeLibraryNotLoadedException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.Closeable;
+import java.util.function.Function;
+
+import static 
org.apache.hadoop.hdds.utils.NativeConstants.ROCKS_TOOLS_NATIVE_LIBRARY_NAME;
+
+/**
+ * JNI for RocksDB RawSSTFileReader.
+ */
+public class ManagedRawSSTFileReader<T> implements Closeable {

Review Comment:
   We need it to be generic, we might require the sequence number and the value 
if we want to optimize on the iops later. Currently we also read from 
toSnapshot as well we can ideally skip that since we are reading the value from 
the sst file anyways.



##########
hadoop-hdds/rocks-native/src/main/java/org/apache/hadoop/hdds/utils/db/managed/ManagedRawSSTFileReaderIterator.java:
##########
@@ -0,0 +1,118 @@
+/*
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.hadoop.hdds.utils.db.managed;
+
+import com.google.common.primitives.UnsignedLong;
+import org.apache.hadoop.hdds.StringUtils;
+import org.apache.hadoop.util.ClosableIterator;
+
+import java.util.Arrays;
+import java.util.function.Function;
+
+/**
+ * Iterator for SSTFileReader which would read all entries including 
tombstones.
+ */
+public class ManagedRawSSTFileReaderIterator<T>

Review Comment:
   done



##########
hadoop-hdds/rocks-native/src/main/java/org/apache/hadoop/hdds/utils/db/managed/ManagedRawSSTFileReaderIterator.java:
##########
@@ -0,0 +1,118 @@
+/*
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.hadoop.hdds.utils.db.managed;
+
+import com.google.common.primitives.UnsignedLong;
+import org.apache.hadoop.hdds.StringUtils;
+import org.apache.hadoop.util.ClosableIterator;
+
+import java.util.Arrays;
+import java.util.function.Function;
+
+/**
+ * Iterator for SSTFileReader which would read all entries including 
tombstones.
+ */
+public class ManagedRawSSTFileReaderIterator<T>
+    implements ClosableIterator<T> {
+  private final long nativeHandle;
+  private final Function<KeyValue, T> transformer;
+
+  ManagedRawSSTFileReaderIterator(long nativeHandle,
+                                  Function<KeyValue, T> transformer) {
+    this.nativeHandle = nativeHandle;
+    this.transformer = transformer;
+  }
+
+  private native boolean hasNext(long handle);
+  private native void next(long handle);
+  private native byte[] getKey(long handle);
+  private native byte[] getValue(long handle);
+  private native long getSequenceNumber(long handle);
+  private native int getType(long handle);
+
+  @Override
+  public boolean hasNext() {
+    return this.hasNext(nativeHandle);
+  }
+
+  @Override
+  public T next() {
+    if (!hasNext()) {
+      return null;

Review Comment:
   done



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to