static class HFileBlockIndex.BlockIndexChunk extends Object
| Modifier and Type | Field and Description | 
|---|---|
| private List<byte[]> | blockKeysFirst keys of the key range corresponding to each index entry. | 
| private List<Long> | blockOffsetsBlock offset in backing stream. | 
| private int | curTotalNonRootEntrySizeThe offset of the next entry to be added, relative to the end of the
 "secondary index" in the "non-root" format representation of this index
 chunk. | 
| private int | curTotalRootSizeThe accumulated size of this chunk if stored in the root index format. | 
| private List<Long> | numSubEntriesAtThe cumulative number of sub-entries, i.e. | 
| private List<Integer> | onDiskDataSizesOn-disk data sizes of lower-level data or index blocks. | 
| private List<Integer> | secondaryIndexOffsetMarksThe "secondary index" used for binary search over variable-length
 records in a "non-root" format block. | 
| Constructor and Description | 
|---|
| BlockIndexChunk() | 
| Modifier and Type | Method and Description | 
|---|---|
| void | add(byte[] firstKey,
   long blockOffset,
   int onDiskDataSize)The same as  add(byte[], long, int, long)but does not take the
 key/value into account. | 
| (package private) void | add(byte[] firstKey,
   long blockOffset,
   int onDiskDataSize,
   long curTotalNumSubEntries)Adds a new entry to this block index chunk. | 
| void | clear() | 
| byte[] | getBlockKey(int i) | 
| long | getBlockOffset(int i) | 
| long | getCumulativeNumKV(int i) | 
| int | getEntryBySubEntry(long k)Finds the entry corresponding to the deeper-level index block containing
 the given deeper-level entry (a "sub-entry"), assuming a global 0-based
 ordering of sub-entries. | 
| byte[] | getMidKeyMetadata()Used when writing the root block index of a multi-level block index. | 
| (package private) int | getNonRootSize() | 
| int | getNumEntries() | 
| int | getOnDiskDataSize(int i) | 
| (package private) int | getRootSize() | 
| (package private) void | writeNonRoot(DataOutput out)Writes the block index chunk in the non-root index block format. | 
| (package private) void | writeRoot(DataOutput out)Writes this chunk into the given output stream in the root block index
 format. | 
private final List<byte[]> blockKeys
private final List<Long> blockOffsets
private final List<Integer> onDiskDataSizes
private final List<Long> numSubEntriesAt
private int curTotalNonRootEntrySize
private int curTotalRootSize
private final List<Integer> secondaryIndexOffsetMarks
BlockIndexChunk()
void add(byte[] firstKey, long blockOffset, int onDiskDataSize, long curTotalNumSubEntries)
firstKey - the first key in the block pointed to by this entryblockOffset - the offset of the next-level block pointed to by this
          entryonDiskDataSize - the on-disk data of the block pointed to by this
          entry, including header sizecurTotalNumSubEntries - if this chunk is the root index chunk under
          construction, this specifies the current total number of
          sub-entries in all leaf-level chunks, including the one
          corresponding to the second-level entry being added.public void add(byte[] firstKey, long blockOffset, int onDiskDataSize)
add(byte[], long, int, long) but does not take the
 key/value into account. Used for single-level indexes.add(byte[], long, int, long)public void clear()
public int getEntryBySubEntry(long k)
Implementation note. We are looking for i such that numSubEntriesAt[i - 1] <= k < numSubEntriesAt[i], because a deeper-level block #i (0-based) contains sub-entries # numSubEntriesAt[i - 1]'th through numSubEntriesAt[i] - 1, assuming a global 0-based ordering of sub-entries. i is by definition the insertion point of k in numSubEntriesAt.
k - sub-entry index, from 0 to the total number sub-entries - 1public byte[] getMidKeyMetadata() throws IOException
IOException - if could not create metadata for computing mid-keyvoid writeNonRoot(DataOutput out) throws IOException
out - IOExceptionint getNonRootSize()
void writeRoot(DataOutput out) throws IOException
HFile version 1 block
 index format, except that we store on-disk size of the block instead of
 its uncompressed size.out - the data output stream to write the block index to. Typically
          a stream writing into an HFile block.IOExceptionint getRootSize()
public int getNumEntries()
public byte[] getBlockKey(int i)
public long getBlockOffset(int i)
public int getOnDiskDataSize(int i)
public long getCumulativeNumKV(int i)
Copyright © 2007–2021 The Apache Software Foundation. All rights reserved.