Interface DataBlockEncoder.EncodedSeeker
- All Known Implementing Classes:
AbstractDataBlockEncoder.AbstractEncodedSeeker
,BufferedDataBlockEncoder.BufferedEncodedSeeker
,CopyKeyDataBlockEncoder.SeekerStateBufferedEncodedSeeker
,DiffKeyDeltaEncoder.DiffSeekerStateBufferedEncodedSeeker
,FastDiffDeltaEncoder.FastDiffSeekerStateBufferedEncodedSeeker
,PrefixKeyDeltaEncoder.SeekerStateBufferedEncodedSeeker
,RowIndexSeekerV1
- Enclosing interface:
- DataBlockEncoder
public static interface DataBlockEncoder.EncodedSeeker
An interface which enable to seek while underlying data is encoded. It works on one HFileBlock,
but it is reusable. See
setCurrentBuffer(ByteBuff)
.-
Method Summary
Modifier and TypeMethodDescriptionint
compareKey
(CellComparator comparator, ExtendedCell key) Compare the given key against the current keygetCell()
Returns the Cell at the current position.getKey()
From the current position creates a cell using the key part of the current bufferDoes a shallow copy of the value at the current position.boolean
next()
Move to next positionvoid
rewind()
Set position to beginning of given blockint
seekToKeyInBlock
(ExtendedCell key, boolean seekBefore) Moves the seeker position within the current block to: the last key that that is less than or equal to the given key ifseekBefore
is false the last key that is strictly less than the given key ifseekBefore
is true.void
setCurrentBuffer
(ByteBuff buffer) Set on which buffer there will be done seeking.
-
Method Details
-
setCurrentBuffer
Set on which buffer there will be done seeking.- Parameters:
buffer
- Used for seeking.
-
getKey
From the current position creates a cell using the key part of the current buffer- Returns:
- key at current position
-
getValueShallowCopy
Does a shallow copy of the value at the current position. A shallow copy is possible because the returned buffer refers to the backing array of the original encoded buffer.- Returns:
- value at current position
-
getCell
Returns the Cell at the current position. Includes memstore timestamp. -
rewind
void rewind()Set position to beginning of given block -
next
boolean next()Move to next position- Returns:
- true on success, false if there is no more positions.
-
seekToKeyInBlock
Moves the seeker position within the current block to:- the last key that that is less than or equal to the given key if
seekBefore
is false - the last key that is strictly less than the given key if
seekBefore
is true. The caller is responsible for loading the previous block if the requested key turns out to be the first key of the current block.
- Parameters:
key
- - Cell to which the seek should happenseekBefore
- find the key strictly less than the given key in case of an exact match. Does not matter in case of an inexact match.- Returns:
- 0 on exact match, 1 on inexact match.
- the last key that that is less than or equal to the given key if
-
compareKey
Compare the given key against the current key- Returns:
- -1 is the passed key is smaller than the current key, 0 if equal and 1 if greater
-