protected abstract static class AbstractHFileReader.Scanner extends Object implements HFileScanner
Modifier and Type | Field and Description |
---|---|
protected ByteBuffer |
blockBuffer |
protected AtomicInteger |
blockFetches |
protected boolean |
cacheBlocks |
protected int |
currKeyLen |
protected long |
currMemstoreTS |
protected int |
currMemstoreTSLen |
protected int |
currValueLen |
protected boolean |
isCompaction |
protected boolean |
pread |
protected HFile.Reader |
reader |
Constructor and Description |
---|
AbstractHFileReader.Scanner(HFile.Reader reader,
boolean cacheBlocks,
boolean pread,
boolean isCompaction) |
Modifier and Type | Method and Description |
---|---|
protected void |
assertSeeked() |
void |
close()
Close the stream socket to handle RS CLOSE_WAIT.
|
HFile.Reader |
getReader() |
boolean |
isSeeked() |
int |
reseekTo(byte[] key)
Reseek to or just before the passed
key . |
boolean |
seekBefore(byte[] key)
Consider the key stream of all the keys in the file,
k[0] .. |
int |
seekTo(byte[] key)
SeekTo or just before the passed
key . |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getKey, getKeyString, getKeyValue, getNextIndexedKey, getValue, getValueString, next, reseekTo, reseekTo, seekBefore, seekBefore, seekTo, seekTo, seekTo
protected ByteBuffer blockBuffer
protected boolean cacheBlocks
protected final boolean pread
protected final boolean isCompaction
protected int currKeyLen
protected int currValueLen
protected int currMemstoreTSLen
protected long currMemstoreTS
protected AtomicInteger blockFetches
protected final HFile.Reader reader
public AbstractHFileReader.Scanner(HFile.Reader reader, boolean cacheBlocks, boolean pread, boolean isCompaction)
public boolean isSeeked()
isSeeked
in interface HFileScanner
HFileScanner.seekBefore(byte[])
or HFileScanner.seekTo()
or HFileScanner.seekTo(byte[])
.
Otherwise returns false.protected void assertSeeked()
public int seekTo(byte[] key) throws IOException
HFileScanner
key
. Examine the return
code to figure whether we found the key or not.
Consider the key stream of all the keys in the file,
k[0] .. k[n]
, where there are n keys in the file.seekTo
in interface HFileScanner
key
- Key to find.IOException
public boolean seekBefore(byte[] key) throws IOException
HFileScanner
k[0] .. k[n]
, where there are n keys in the file.seekBefore
in interface HFileScanner
key
- Key to findIOException
public int reseekTo(byte[] key) throws IOException
HFileScanner
key
. Similar to seekTo
except that this can be called even if the scanner is not at the beginning
of a file.
This can be used to seek only to keys which come after the current position
of the scanner.
Consider the key stream of all the keys in the file,
k[0] .. k[n]
, where there are n keys in the file after
current position of HFileScanner.
The scanner will position itself between k[i] and k[i+1] where
k[i] < key <= k[i+1].
If there is no key k[i+1] greater than or equal to the input key, then the
scanner will position itself at the end of the file and next() will return
false when it is called.reseekTo
in interface HFileScanner
key
- Key to find (should be non-null)IOException
public HFile.Reader getReader()
getReader
in interface HFileScanner
public void close()
HFileScanner
close
in interface HFileScanner
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.