Class LedgerFragment


  • public class LedgerFragment
    extends java.lang.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 Detail

      • LedgerFragment

        public LedgerFragment​(LedgerHandle lh,
                              long firstEntryId,
                              long lastKnownEntryId,
                              java.util.Set<java.lang.Integer> bookieIndexes)
      • LedgerFragment

        public LedgerFragment​(LedgerFragment lf,
                              java.util.Set<java.lang.Integer> subset)
    • Method Detail

      • subset

        public LedgerFragment subset​(java.util.Set<java.lang.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 java.util.Set<BookieId> getAddresses()
      • getBookiesIndexes

        public java.util.Set<java.lang.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 java.lang.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 java.lang.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 java.util.List<BookieId> getEnsemble()
        Gets the ensemble of fragment.
        Returns:
        the ensemble for the segment which this fragment is a part of
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object