swamirishi commented on code in PR #9489:
URL: https://github.com/apache/ozone/pull/9489#discussion_r2615731243
##########
hadoop-hdds/rocks-native/src/main/java/org/apache/hadoop/hdds/utils/db/ManagedRawSSTFileIterator.java:
##########
@@ -31,19 +30,33 @@ public class ManagedRawSSTFileIterator<T> implements
ClosableIterator<T> {
// Native address of pointer to the object.
private final long nativeHandle;
private final Function<KeyValue, T> transformer;
+ private final IteratorType type;
+ private boolean closed;
+ private final Buffer keyBuffer;
+ private final Buffer valueBuffer;
- ManagedRawSSTFileIterator(long nativeHandle, Function<KeyValue, T>
transformer) {
+ ManagedRawSSTFileIterator(String name, long nativeHandle, Function<KeyValue,
T> transformer, IteratorType type) {
this.nativeHandle = nativeHandle;
this.transformer = transformer;
+ this.type = type;
+ this.closed = false;
+ this.keyBuffer = new Buffer(
+ new CodecBuffer.Capacity(name + " iterator-key", 1 << 10),
+ this.type.readKey() ? buffer -> this.getKey(this.nativeHandle, buffer,
buffer.position(),
+ buffer.remaining()) : null);
+ this.valueBuffer = new Buffer(
+ new CodecBuffer.Capacity(name + " iterator-value", 4 << 10),
+ this.type.readValue() ? buffer -> this.getValue(this.nativeHandle,
buffer, buffer.position(),
Review Comment:
Yeah this is the internal of Buffer class which would automatically resize
based on the length returned by the function this.getValue(this.nativeHandle,
buffer, buffer.position(),
--
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]