public static class HFileBlockIndex.BlockIndexWriter extends Object implements InlineBlockWriter
| 构造器和说明 |
|---|
BlockIndexWriter()
Creates a single-level block index writer
|
BlockIndexWriter(org.apache.hadoop.hbase.io.hfile.HFileBlock.Writer blockWriter,
CacheConfig cacheConf,
String nameForCaching)
Creates a multi-level block index writer.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addEntry(byte[] firstKey,
long blockOffset,
int blockDataSize)
Add one index entry to the current leaf-level block.
|
void |
blockWritten(long offset,
int onDiskSize,
int uncompressedSize)
Called after an inline block has been written so that we can add an
entry referring to that block to the parent-level index.
|
void |
ensureSingleLevel() |
boolean |
getCacheOnWrite() |
BlockType |
getInlineBlockType()
The type of blocks this block writer produces.
|
int |
getNumLevels() |
int |
getNumRootEntries() |
long |
getTotalUncompressedSize()
The total uncompressed size of the root index block, intermediate-level
index blocks, and leaf-level index blocks.
|
void |
setMaxChunkSize(int maxChunkSize) |
void |
setMinIndexNumEntries(int minIndexNumEntries) |
boolean |
shouldWriteBlock(boolean closing)
Whether there is an inline block ready to be written.
|
long |
writeIndexBlocks(org.apache.hadoop.fs.FSDataOutputStream out)
Writes the root level and intermediate levels of the block index into
the output stream, generating the tree from bottom up.
|
void |
writeInlineBlock(DataOutput out)
Write out the current inline index block.
|
void |
writeSingleLevelIndex(DataOutput out,
String description)
Writes the block index data as a single level only.
|
public BlockIndexWriter()
public BlockIndexWriter(org.apache.hadoop.hbase.io.hfile.HFileBlock.Writer blockWriter, CacheConfig cacheConf, String nameForCaching)
blockWriter - the block writer to use to write index blockscacheConf - used to determine when and how a block should be cached-on-write.public void setMaxChunkSize(int maxChunkSize)
public void setMinIndexNumEntries(int minIndexNumEntries)
public long writeIndexBlocks(org.apache.hadoop.fs.FSDataOutputStream out)
throws IOException
out - FSDataOutputStreamIOExceptionpublic void writeSingleLevelIndex(DataOutput out, String description) throws IOException
out - the buffered output stream to write the index to. Typically a
stream writing into an HFile block.description - a short description of the index being written. Used
in a log message.IOExceptionpublic final int getNumRootEntries()
public int getNumLevels()
public boolean shouldWriteBlock(boolean closing)
shouldWriteBlock 在接口中 InlineBlockWriterclosing - whether the file is being closed, in which case we need to write
out all available data and not wait to accumulate another blockpublic void writeInlineBlock(DataOutput out) throws IOException
writeInlineBlock 在接口中 InlineBlockWriterout - IOExceptionpublic void blockWritten(long offset,
int onDiskSize,
int uncompressedSize)
blockWritten 在接口中 InlineBlockWriteroffset - the offset of the block in the streamonDiskSize - the on-disk size of the blockuncompressedSize - the uncompressed size of the blockpublic BlockType getInlineBlockType()
InlineBlockWritergetInlineBlockType 在接口中 InlineBlockWriterpublic void addEntry(byte[] firstKey,
long blockOffset,
int blockDataSize)
public void ensureSingleLevel()
throws IOException
IOException - if we happened to write a multi-level index.public boolean getCacheOnWrite()
getCacheOnWrite 在接口中 InlineBlockWriterpublic long getTotalUncompressedSize()
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.