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 ClassesModifier and TypeInterfaceDescriptionstatic interfaceAn 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 interfaceInterface to keep track of which bookies in an ensemble, an action has been performed for.static interfaceA write set represents the set of bookies to which a request will be written. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionReturns an ackset object, responses should be checked against this.Returns an ackset object useful to wait for all bookies in the ensemble, responses should be checked against this.getEnsembleSet(long entryId) Return the set of bookies indices to send the messages to the whole ensemble.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.intgetWriteSet(long entryId) Return the set of bookie indices to send the message to.intgetWriteSetBookieIndex(long entryId, int writeSetIndex) Return the WriteSet bookie index for a given and index in the WriteSet.booleanhasEntry(long entryId, int bookieIndex) Whether entry presents on given bookie index.
-
Field Details
-
NULL_WRITE_SET
-
-
Method Details
-
getWriteQuorumSize
int getWriteQuorumSize() -
getWriteSet
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
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
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
-