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:
java.io.Closeable,java.lang.AutoCloseable
public class BlockAwareSegmentInputStreamImpl extends BlockAwareSegmentInputStream
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
Constructors Constructor Description BlockAwareSegmentInputStreamImpl(org.apache.bookkeeper.client.api.ReadHandle ledger, long startEntryId, int blockSize)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static intcalculateBlockSize(int maxBlockSize, org.apache.bookkeeper.client.api.ReadHandle readHandle, long firstEntryToWrite, long entryBytesAlreadyWritten)voidclose()intgetBlockEntryBytesCount()Get sum of entries data size read from the this InputStream.intgetBlockEntryCount()Get entry count that read out from this InputStream.intgetBlockSize()Get block size that could read out from this InputStream.longgetEndEntryId()Get end entry id contained in this InputStream.static longgetHeaderSize()org.apache.bookkeeper.client.api.ReadHandlegetLedger()Get the ledger, from which this InputStream read data.longgetStartEntryId()Get start entry id contained in this InputStream.intread()
-
-
-
Method Detail
-
read
public int read() throws java.io.IOException- Specified by:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.InputStream- Throws:
java.io.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
-
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)
-
-