Interface OffloadIndexBlock
-
- All Superinterfaces:
java.lang.AutoCloseable,java.io.Closeable,OffloadIndexBlockV2
- All Known Implementing Classes:
OffloadIndexBlockImpl
@Unstable public interface OffloadIndexBlock extends java.io.Closeable, OffloadIndexBlockV2
The Index block abstraction used for offload a ledger to long term storage.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classOffloadIndexBlock.IndexInputStreamAn input stream which knows the size of the stream upfront.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description 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.default OffloadIndexEntrygetIndexEntryForEntry(long ledgerId, long messageEntryId)Get the related OffloadIndexEntry that contains the given messageEntryId.org.apache.bookkeeper.client.api.LedgerMetadatagetLedgerMetadata()Get LedgerMetadata.default org.apache.bookkeeper.client.api.LedgerMetadatagetLedgerMetadata(long ledgerId)Get LedgerMetadata.default longgetStartEntryId(long ledgerId)OffloadIndexBlock.IndexInputStreamtoStream()Get the content of the index block as InputStream.
-
-
-
Method Detail
-
toStream
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 | index_entry_count | | data_object_size | segment_metadata_length | segment metadata | index entries ... |- Specified by:
toStreamin interfaceOffloadIndexBlockV2- Throws:
java.io.IOException
-
getIndexEntryForEntry
OffloadIndexEntry getIndexEntryForEntry(long messageEntryId) throws java.io.IOException
Get the related OffloadIndexEntry that contains the given messageEntryId.- Parameters:
messageEntryId- the entry id of message- Returns:
- the offload index entry
- Throws:
java.io.IOException
-
getEntryCount
int getEntryCount()
Get the entry count that contained in this index Block.- Specified by:
getEntryCountin interfaceOffloadIndexBlockV2
-
getLedgerMetadata
org.apache.bookkeeper.client.api.LedgerMetadata getLedgerMetadata()
Get LedgerMetadata.
-
getDataObjectLength
long getDataObjectLength()
Get the total size of the data object.- Specified by:
getDataObjectLengthin interfaceOffloadIndexBlockV2
-
getDataBlockHeaderLength
long getDataBlockHeaderLength()
Get the length of the header in the blocks in the data object.- Specified by:
getDataBlockHeaderLengthin interfaceOffloadIndexBlockV2
-
getIndexEntryForEntry
default OffloadIndexEntry getIndexEntryForEntry(long ledgerId, long messageEntryId) throws java.io.IOException
Description copied from interface:OffloadIndexBlockV2Get the related OffloadIndexEntry that contains the given messageEntryId.- Specified by:
getIndexEntryForEntryin interfaceOffloadIndexBlockV2messageEntryId- the entry id of message- Returns:
- the offload index entry
- Throws:
java.io.IOException
-
getStartEntryId
default long getStartEntryId(long ledgerId)
- Specified by:
getStartEntryIdin interfaceOffloadIndexBlockV2
-
getLedgerMetadata
default org.apache.bookkeeper.client.api.LedgerMetadata getLedgerMetadata(long ledgerId)
Description copied from interface:OffloadIndexBlockV2Get LedgerMetadata.- Specified by:
getLedgerMetadatain interfaceOffloadIndexBlockV2- Returns:
-
-