Class LedgerFragment

java.lang.Object
org.apache.bookkeeper.client.LedgerFragment

public class LedgerFragment extends Object
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

  • Constructor Details

  • Method Details

    • subset

      public LedgerFragment subset(Set<Integer> 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,
      1. If ledger is in closed state, then no other clients can modify this fragment.
      2. 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

      public BookieId getAddress(int bookieIndex)
      Gets the failedBookie address.
    • getAddresses

      public Set<BookieId> getAddresses()
    • getBookiesIndexes

      public Set<Integer> getBookiesIndexes()
      Gets the failedBookie index.
    • getFirstStoredEntryId

      public long getFirstStoredEntryId()
      Gets the first stored entry id of the fragment in failed bookies.
      Returns:
      entryId
    • getFirstStoredEntryId

      public Long getFirstStoredEntryId(int bookieIndex)
      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

      public Long getLastStoredEntryId(int bookieIndex)
      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

      public List<BookieId> getEnsemble()
      Gets the ensemble of fragment.
      Returns:
      the ensemble for the segment which this fragment is a part of
    • getReplicateType

      public LedgerFragment.ReplicateType getReplicateType()
    • setReplicateType

      public void setReplicateType(LedgerFragment.ReplicateType replicateType)
    • toString

      public String toString()
      Overrides:
      toString in class Object