Class BlockAwareSegmentInputStreamImpl
java.lang.Object
java.io.InputStream
org.apache.bookkeeper.mledger.offload.jcloud.BlockAwareSegmentInputStream
org.apache.bookkeeper.mledger.offload.jcloud.impl.BlockAwareSegmentInputStreamImpl
- All Implemented Interfaces:
Closeable,AutoCloseable
The BlockAwareSegmentInputStreamImpl for each cold storage data block.
It gets data from ledger, and will be read out the content for a data block.
DataBlockHeader + entries(each with format[[entry_size -- int][entry_id -- long][entry_data]]) + padding
-
Constructor Summary
ConstructorsConstructorDescriptionBlockAwareSegmentInputStreamImpl(org.apache.bookkeeper.client.api.ReadHandle ledger, long startEntryId, int blockSize) BlockAwareSegmentInputStreamImpl(org.apache.bookkeeper.client.api.ReadHandle ledger, long startEntryId, int blockSize, LedgerOffloaderStats offloaderStats, String ledgerName) -
Method Summary
Modifier and TypeMethodDescriptionstatic intcalculateBlockSize(int maxBlockSize, org.apache.bookkeeper.client.api.ReadHandle readHandle, long firstEntryToWrite, long entryBytesAlreadyWritten) voidclose()intGet sum of entries data size read from the this InputStream.intGet entry count that read out from this InputStream.intGet block size that could read out from this InputStream.intlongGet end entry id contained in this InputStream.static longorg.apache.bookkeeper.client.api.ReadHandleGet the ledger, from which this InputStream read data.longGet start entry id contained in this InputStream.intread()intread(byte[] b, int off, int len) Methods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Constructor Details
-
BlockAwareSegmentInputStreamImpl
public BlockAwareSegmentInputStreamImpl(org.apache.bookkeeper.client.api.ReadHandle ledger, long startEntryId, int blockSize) -
BlockAwareSegmentInputStreamImpl
public BlockAwareSegmentInputStreamImpl(org.apache.bookkeeper.client.api.ReadHandle ledger, long startEntryId, int blockSize, LedgerOffloaderStats offloaderStats, String ledgerName)
-
-
Method Details
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
getLedger
public org.apache.bookkeeper.client.api.ReadHandle getLedger()Description copied from class:BlockAwareSegmentInputStreamGet the ledger, from which this InputStream read data.- Specified by:
getLedgerin classBlockAwareSegmentInputStream
-
getStartEntryId
public long getStartEntryId()Description copied from class:BlockAwareSegmentInputStreamGet start entry id contained in this InputStream.- Specified by:
getStartEntryIdin classBlockAwareSegmentInputStream- Returns:
- the start entry id
-
getBlockSize
public int getBlockSize()Description copied from class:BlockAwareSegmentInputStreamGet block size that could read out from this InputStream.- Specified by:
getBlockSizein classBlockAwareSegmentInputStream- Returns:
- the block size
-
getDataBlockFullOffset
public int getDataBlockFullOffset() -
getBlockEntryCount
public int getBlockEntryCount()Description copied from class:BlockAwareSegmentInputStreamGet entry count that read out from this InputStream.- Specified by:
getBlockEntryCountin classBlockAwareSegmentInputStream- Returns:
- the block entry count
-
getEndEntryId
public long getEndEntryId()Description copied from class:BlockAwareSegmentInputStreamGet end entry id contained in this InputStream.- Specified by:
getEndEntryIdin classBlockAwareSegmentInputStream- Returns:
- the end entry id
-
getBlockEntryBytesCount
public int getBlockEntryBytesCount()Description copied from class:BlockAwareSegmentInputStreamGet sum of entries data size read from the this InputStream.- Specified by:
getBlockEntryBytesCountin classBlockAwareSegmentInputStream- Returns:
- the block entry bytes count
-
getHeaderSize
public static long getHeaderSize() -
calculateBlockSize
public static int calculateBlockSize(int maxBlockSize, org.apache.bookkeeper.client.api.ReadHandle readHandle, long firstEntryToWrite, long entryBytesAlreadyWritten)
-