Interface DistributionSchedule

  • All Known Implementing Classes:

    public interface DistributionSchedule
    This interface determins how entries are distributed among bookies.

    Every entry gets replicated to some number of replicas. The first replica for an entry is given a replicaIndex of 0, and so on. To distribute write load, not all entries go to all bookies. Given an entry-id and replica index, an DistributionSchedule determines which bookie that replica should go to.

    • Method Detail

      • getEnsembleSet

        DistributionSchedule.WriteSet getEnsembleSet​(long entryId)
        Return the set of bookies indices to send the messages to the whole ensemble.
        entryId - entry id used to calculate the ensemble.
        the set of bookies indices to send the request.
      • getEnsembleAckSet

        DistributionSchedule.AckSet getEnsembleAckSet()
        Returns an ackset object useful to wait for all bookies in the ensemble, responses should be checked against this.
      • hasEntry

        boolean hasEntry​(long entryId,
                         int bookieIndex)
        Whether entry presents on given bookie index.
        entryId - - entryId to check the presence on given bookie index
        bookieIndex - - bookie index on which it need to check the possible presence of the entry
        true if it has entry otherwise false.
      • getEntriesStripedToTheBookie

        java.util.BitSet getEntriesStripedToTheBookie​(int bookieIndex,
                                                      long startEntryId,
                                                      long lastEntryId)
        Get the bitset representing the entries from entry 'startEntryId' to 'lastEntryId', that would be striped to the bookie with index - bookieIndex. Value of the bit with the 'bitIndex+n', indicate whether entry with entryid 'startEntryId+n' is striped to this bookie or not.
        bookieIndex - index of the bookie in the ensemble starting with 0
        startEntryId - starting entryid
        lastEntryId - last entryid
        the bitset representing the entries that would be striped to the bookie