Package org.apache.bookkeeper.util
Class AvailabilityOfEntriesOfLedger
java.lang.Object
org.apache.bookkeeper.util.AvailabilityOfEntriesOfLedger
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
FieldsModifier and TypeFieldDescriptionstatic final intstatic final AvailabilityOfEntriesOfLedgerstatic final intstatic final longstatic final int -
Constructor Summary
ConstructorsConstructorDescriptionAvailabilityOfEntriesOfLedger(byte[] serializeStateOfEntriesOfLedger) AvailabilityOfEntriesOfLedger(long[] entriesOfLedger) AvailabilityOfEntriesOfLedger(io.netty.buffer.ByteBuf byteBuf) AvailabilityOfEntriesOfLedger(PrimitiveIterator.OfLong entriesOfLedgerItr) -
Method Summary
Modifier and TypeMethodDescriptionlonggetUnavailableEntries(long startEntryId, long lastEntryId, BitSet availabilityOfEntries) booleanisEntryAvailable(long entryId) byte[]
-
Field Details
-
INVALID_ENTRYID
public static final long INVALID_ENTRYID- See Also:
-
EMPTY_AVAILABILITYOFENTRIESOFLEDGER
-
HEADER_SIZE
public static final int HEADER_SIZE- See Also:
-
V0
public static final int V0- See Also:
-
CURRENT_HEADER_VERSION
public static final int CURRENT_HEADER_VERSION- See Also:
-
-
Constructor Details
-
AvailabilityOfEntriesOfLedger
-
AvailabilityOfEntriesOfLedger
public AvailabilityOfEntriesOfLedger(long[] entriesOfLedger) -
AvailabilityOfEntriesOfLedger
public AvailabilityOfEntriesOfLedger(byte[] serializeStateOfEntriesOfLedger) -
AvailabilityOfEntriesOfLedger
public AvailabilityOfEntriesOfLedger(io.netty.buffer.ByteBuf byteBuf)
-
-
Method Details
-
serializeStateOfEntriesOfLedger
public byte[] serializeStateOfEntriesOfLedger() -
isEntryAvailable
public boolean isEntryAvailable(long entryId) -
getTotalNumOfAvailableEntries
public long getTotalNumOfAvailableEntries()
-