Package org.apache.bookkeeper.util
Class AvailabilityOfEntriesOfLedger
- java.lang.Object
-
- org.apache.bookkeeper.util.AvailabilityOfEntriesOfLedger
-
public class AvailabilityOfEntriesOfLedger extends java.lang.Object
Ordered collection of SequenceGroups will represent entries of the ledger residing in a bookie.In the byte array representation of AvailabilityOfEntriesOfLedger, for the sake of future extensibility it would be helpful to have reserved space for header at the beginning. So the first 64 bytes will be used for header, with the first four bytes specifying the int version number, next four bytes specifying the number of sequencegroups for now and the rest of the bytes in the reserved space will be 0's. The encoded format will be represented after the first 64 bytes. The ordered collection of SequenceGroups will be appended sequentially to this byte array, with each SequenceGroup taking 24 bytes.
-
-
Field Summary
Fields Modifier and Type Field Description static int
CURRENT_HEADER_VERSION
static AvailabilityOfEntriesOfLedger
EMPTY_AVAILABILITYOFENTRIESOFLEDGER
static int
HEADER_SIZE
static long
INVALID_ENTRYID
static int
V0
-
Constructor Summary
Constructors Constructor Description AvailabilityOfEntriesOfLedger(byte[] serializeStateOfEntriesOfLedger)
AvailabilityOfEntriesOfLedger(long[] entriesOfLedger)
AvailabilityOfEntriesOfLedger(io.netty.buffer.ByteBuf byteBuf)
AvailabilityOfEntriesOfLedger(java.util.PrimitiveIterator.OfLong entriesOfLedgerItr)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getTotalNumOfAvailableEntries()
java.util.List<java.lang.Long>
getUnavailableEntries(long startEntryId, long lastEntryId, java.util.BitSet availabilityOfEntries)
boolean
isEntryAvailable(long entryId)
byte[]
serializeStateOfEntriesOfLedger()
-
-
-
Field Detail
-
INVALID_ENTRYID
public static final long INVALID_ENTRYID
- See Also:
- Constant Field Values
-
EMPTY_AVAILABILITYOFENTRIESOFLEDGER
public static final AvailabilityOfEntriesOfLedger EMPTY_AVAILABILITYOFENTRIESOFLEDGER
-
HEADER_SIZE
public static final int HEADER_SIZE
- See Also:
- Constant Field Values
-
V0
public static final int V0
- See Also:
- Constant Field Values
-
CURRENT_HEADER_VERSION
public static final int CURRENT_HEADER_VERSION
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AvailabilityOfEntriesOfLedger
public AvailabilityOfEntriesOfLedger(java.util.PrimitiveIterator.OfLong entriesOfLedgerItr)
-
AvailabilityOfEntriesOfLedger
public AvailabilityOfEntriesOfLedger(long[] entriesOfLedger)
-
AvailabilityOfEntriesOfLedger
public AvailabilityOfEntriesOfLedger(byte[] serializeStateOfEntriesOfLedger)
-
AvailabilityOfEntriesOfLedger
public AvailabilityOfEntriesOfLedger(io.netty.buffer.ByteBuf byteBuf)
-
-
Method Detail
-
serializeStateOfEntriesOfLedger
public byte[] serializeStateOfEntriesOfLedger()
-
isEntryAvailable
public boolean isEntryAvailable(long entryId)
-
getUnavailableEntries
public java.util.List<java.lang.Long> getUnavailableEntries(long startEntryId, long lastEntryId, java.util.BitSet availabilityOfEntries)
-
getTotalNumOfAvailableEntries
public long getTotalNumOfAvailableEntries()
-
-