Class OffloadIndexBlockImpl
- java.lang.Object
-
- org.apache.bookkeeper.mledger.offload.jcloud.impl.OffloadIndexBlockImpl
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,OffloadIndexBlock,OffloadIndexBlockV2
public class OffloadIndexBlockImpl extends java.lang.Object implements OffloadIndexBlock
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.bookkeeper.mledger.offload.jcloud.OffloadIndexBlock
OffloadIndexBlock.IndexInputStream
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()static OffloadIndexBlockImplget(int magic, java.io.DataInputStream stream)static OffloadIndexBlockImplget(org.apache.bookkeeper.client.api.LedgerMetadata metadata, long dataObjectLength, long dataHeaderLength, java.util.List<OffloadIndexEntryImpl> entries)longgetDataBlockHeaderLength()Get the length of the header in the blocks in the data object.longgetDataObjectLength()Get the total size of the data object.intgetEntryCount()Get the entry count that contained in this index Block.OffloadIndexEntrygetIndexEntryForEntry(long messageEntryId)Get the related OffloadIndexEntry that contains the given messageEntryId.static intgetIndexMagicWord()org.apache.bookkeeper.client.api.LedgerMetadatagetLedgerMetadata()Get LedgerMetadata.voidrecycle()OffloadIndexBlock.IndexInputStreamtoStream()Get the content of the index block as InputStream.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.bookkeeper.mledger.offload.jcloud.OffloadIndexBlock
getIndexEntryForEntry, getLedgerMetadata, getStartEntryId
-
-
-
-
Method Detail
-
get
public static OffloadIndexBlockImpl get(org.apache.bookkeeper.client.api.LedgerMetadata metadata, long dataObjectLength, long dataHeaderLength, java.util.List<OffloadIndexEntryImpl> entries)
-
get
public static OffloadIndexBlockImpl get(int magic, java.io.DataInputStream stream) throws java.io.IOException
- Throws:
java.io.IOException
-
recycle
public void recycle()
-
getIndexEntryForEntry
public OffloadIndexEntry getIndexEntryForEntry(long messageEntryId) throws java.io.IOException
Description copied from interface:OffloadIndexBlockGet the related OffloadIndexEntry that contains the given messageEntryId.- Specified by:
getIndexEntryForEntryin interfaceOffloadIndexBlock- Parameters:
messageEntryId- the entry id of message- Returns:
- the offload index entry
- Throws:
java.io.IOException
-
getEntryCount
public int getEntryCount()
Description copied from interface:OffloadIndexBlockGet the entry count that contained in this index Block.- Specified by:
getEntryCountin interfaceOffloadIndexBlock- Specified by:
getEntryCountin interfaceOffloadIndexBlockV2
-
getLedgerMetadata
public org.apache.bookkeeper.client.api.LedgerMetadata getLedgerMetadata()
Description copied from interface:OffloadIndexBlockGet LedgerMetadata.- Specified by:
getLedgerMetadatain interfaceOffloadIndexBlock
-
getDataObjectLength
public long getDataObjectLength()
Description copied from interface:OffloadIndexBlockGet the total size of the data object.- Specified by:
getDataObjectLengthin interfaceOffloadIndexBlock- Specified by:
getDataObjectLengthin interfaceOffloadIndexBlockV2
-
getDataBlockHeaderLength
public long getDataBlockHeaderLength()
Description copied from interface:OffloadIndexBlockGet the length of the header in the blocks in the data object.- Specified by:
getDataBlockHeaderLengthin interfaceOffloadIndexBlock- Specified by:
getDataBlockHeaderLengthin interfaceOffloadIndexBlockV2
-
toStream
public OffloadIndexBlock.IndexInputStream toStream() throws java.io.IOException
Get the content of the index block as InputStream. Read out in format: | index_magic_header | index_block_len | data_object_len | data_header_len | | index_entry_count | segment_metadata_len | segment metadata | index entries... |- Specified by:
toStreamin interfaceOffloadIndexBlock- Specified by:
toStreamin interfaceOffloadIndexBlockV2- Throws:
java.io.IOException
-
getIndexMagicWord
public static int getIndexMagicWord()
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-
-