Package org.apache.bookkeeper.client
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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
DistributionSchedule.AckSet
An ack set represents the set of bookies from which a response must be received so that an entry can be considered to be replicated on a quorum.static interface
DistributionSchedule.QuorumCoverageSet
Interface to keep track of which bookies in an ensemble, an action has been performed for.static interface
DistributionSchedule.WriteSet
A write set represents the set of bookies to which a request will be written.
-
Field Summary
Fields Modifier and Type Field Description static DistributionSchedule.WriteSet
NULL_WRITE_SET
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description DistributionSchedule.AckSet
getAckSet()
Returns an ackset object, responses should be checked against this.DistributionSchedule.QuorumCoverageSet
getCoverageSet()
DistributionSchedule.AckSet
getEnsembleAckSet()
Returns an ackset object useful to wait for all bookies in the ensemble, responses should be checked against this.DistributionSchedule.WriteSet
getEnsembleSet(long entryId)
Return the set of bookies indices to send the messages to the whole ensemble.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.int
getWriteQuorumSize()
DistributionSchedule.WriteSet
getWriteSet(long entryId)
Return the set of bookie indices to send the message to.int
getWriteSetBookieIndex(long entryId, int writeSetIndex)
Return the WriteSet bookie index for a given and index in the WriteSet.boolean
hasEntry(long entryId, int bookieIndex)
Whether entry presents on given bookie index.
-
-
-
Field Detail
-
NULL_WRITE_SET
static final DistributionSchedule.WriteSet NULL_WRITE_SET
-
-
Method Detail
-
getWriteQuorumSize
int getWriteQuorumSize()
-
getWriteSet
DistributionSchedule.WriteSet getWriteSet(long entryId)
Return the set of bookie indices to send the message to.
-
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.
-
getAckSet
DistributionSchedule.AckSet getAckSet()
Returns an ackset object, responses should be checked against this.
-
getEnsembleAckSet
DistributionSchedule.AckSet getEnsembleAckSet()
Returns an ackset object useful to wait for all bookies in the ensemble, responses should be checked against this.
-
getCoverageSet
DistributionSchedule.QuorumCoverageSet getCoverageSet()
-
hasEntry
boolean hasEntry(long entryId, int bookieIndex)
Whether entry presents on given bookie index.- Parameters:
entryId
- - entryId to check the presence on given bookie indexbookieIndex
- - 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 0startEntryId
- starting entryidlastEntryId
- last entryid- Returns:
- the bitset representing the entries that would be striped to the bookie
-
-