Interface DistributionSchedule

  • All Known Implementing Classes:
    RoundRobinDistributionSchedule

    public interface DistributionSchedule
    This interface determines 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

      • getWriteQuorumSize

        int getWriteQuorumSize()
      • getWriteSetBookieIndex

        int getWriteSetBookieIndex​(long entryId,
                                   int writeSetIndex)
        Return the WriteSet bookie index for a given and index in the WriteSet.
        Parameters:
        entryId -
        writeSetIndex -
        Returns:
      • getEnsembleSet

        DistributionSchedule.WriteSet getEnsembleSet​(long entryId)
        Return the set of bookies indices to send the messages to the whole ensemble.
        Parameters:
        entryId - entry id used to calculate the ensemble.
        Returns:
        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.
        Parameters:
        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
        Returns:
        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.
        Parameters:
        bookieIndex - index of the bookie in the ensemble starting with 0
        startEntryId - starting entryid
        lastEntryId - last entryid
        Returns:
        the bitset representing the entries that would be striped to the bookie