Package org.apache.bookkeeper.client
Class LedgerFragment
java.lang.Object
org.apache.bookkeeper.client.LedgerFragment
Represents the entries of a segment of a ledger which are stored on subset of
bookies in the segments bookie ensemble.
Used for checking and recovery
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionLedgerFragment(LedgerFragment lf, Set<Integer> subset) LedgerFragment(LedgerHandle lh, long firstEntryId, long lastKnownEntryId, Set<Integer> bookieIndexes) -
Method Summary
Modifier and TypeMethodDescriptiongetAddress(int bookieIndex) Gets the failedBookie address.Gets the failedBookie index.Gets the ensemble of fragment.longlongGets the first stored entry id of the fragment in failed bookies.getFirstStoredEntryId(int bookieIndex) Get the first stored entry id of the fragment in the given failed bookies.longlongGets the last stored entry id of the fragment in failed bookie.getLastStoredEntryId(int bookieIndex) Get the last stored entry id of the fragment in the given failed bookie.longbooleanisClosed()Returns true, if and only if the ledger fragment will never be modified by any of the clients in future, otherwise false.booleanisStoredEntryId(long entryId, int bookieIndex) voidsetReplicateType(LedgerFragment.ReplicateType replicateType) Return a ledger fragment contains subset of bookies.toString()
-
Constructor Details
-
LedgerFragment
public LedgerFragment(LedgerHandle lh, long firstEntryId, long lastKnownEntryId, Set<Integer> bookieIndexes) -
LedgerFragment
-
-
Method Details
-
subset
Return a ledger fragment contains subset of bookies.- Parameters:
subset- subset of bookies.- Returns:
- ledger fragment contains subset of bookies
-
isClosed
public boolean isClosed()Returns true, if and only if the ledger fragment will never be modified by any of the clients in future, otherwise false. i.e,- If ledger is in closed state, then no other clients can modify this fragment.
- If ledger is not in closed state and the current fragment is not a last fragment, then no one will modify this fragment.
-
getLedgerId
public long getLedgerId() -
getFirstEntryId
public long getFirstEntryId() -
getLastKnownEntryId
public long getLastKnownEntryId() -
getAddress
Gets the failedBookie address. -
getAddresses
-
getBookiesIndexes
Gets the failedBookie index. -
getFirstStoredEntryId
public long getFirstStoredEntryId()Gets the first stored entry id of the fragment in failed bookies.- Returns:
- entryId
-
getFirstStoredEntryId
Get the first stored entry id of the fragment in the given failed bookies.- Parameters:
bookieIndex- the bookie index in the ensemble.- Returns:
- first stored entry id on the bookie.
-
getLastStoredEntryId
public long getLastStoredEntryId()Gets the last stored entry id of the fragment in failed bookie.- Returns:
- entryId
-
getLastStoredEntryId
Get the last stored entry id of the fragment in the given failed bookie.- Parameters:
bookieIndex- the bookie index in the ensemble.- Returns:
- first stored entry id on the bookie.
-
isStoredEntryId
public boolean isStoredEntryId(long entryId, int bookieIndex) -
getEnsemble
Gets the ensemble of fragment.- Returns:
- the ensemble for the segment which this fragment is a part of
-
getReplicateType
-
setReplicateType
-
toString
-