Package org.apache.bookkeeper.client
Interface ITopologyAwareEnsemblePlacementPolicy<T extends Node>
-
- All Superinterfaces:
EnsemblePlacementPolicy
- All Known Implementing Classes:
RackawareEnsemblePlacementPolicy
,RackawareEnsemblePlacementPolicyImpl
,RegionAwareEnsemblePlacementPolicy
,TopologyAwareEnsemblePlacementPolicy
,ZoneawareEnsemblePlacementPolicy
,ZoneawareEnsemblePlacementPolicyImpl
@Private @Evolving public interface ITopologyAwareEnsemblePlacementPolicy<T extends Node> extends EnsemblePlacementPolicy
Interface for topology aware ensemble placement policy.All the implementations of this interface are using
NetworkTopology
for placing ensembles.- See Also:
EnsemblePlacementPolicy
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
ITopologyAwareEnsemblePlacementPolicy.Ensemble<T extends Node>
Ensemble used to hold the result of an ensemble selected for placement.static interface
ITopologyAwareEnsemblePlacementPolicy.Predicate<T extends Node>
Predicate used when choosing an ensemble.-
Nested classes/interfaces inherited from interface org.apache.bookkeeper.client.EnsemblePlacementPolicy
EnsemblePlacementPolicy.PlacementPolicyAdherence, EnsemblePlacementPolicy.PlacementResult<T>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
handleBookiesThatJoined(java.util.Set<BookieId> joinedBookies)
Handle bookies that joined.void
handleBookiesThatLeft(java.util.Set<BookieId> leftBookies)
Handle bookies that left.EnsemblePlacementPolicy.PlacementResult<java.util.List<BookieId>>
newEnsemble(int ensembleSize, int writeQuorumSize, int ackQuorumSize, java.util.Set<BookieId> excludeBookies, ITopologyAwareEnsemblePlacementPolicy.Ensemble<T> parentEnsemble, ITopologyAwareEnsemblePlacementPolicy.Predicate<T> parentPredicate)
Create an ensemble with parent ensemble.void
onBookieRackChange(java.util.List<BookieId> bookieAddressList)
Handle rack change for the bookies.T
selectFromNetworkLocation(java.lang.String networkLoc, java.util.Set<java.lang.String> excludeRacks, java.util.Set<Node> excludeBookies, ITopologyAwareEnsemblePlacementPolicy.Predicate<BookieNode> predicate, ITopologyAwareEnsemblePlacementPolicy.Ensemble<BookieNode> ensemble, boolean fallbackToRandom)
Select a node from networkLoc rack excluding excludeBookies.T
selectFromNetworkLocation(java.lang.String networkLoc, java.util.Set<Node> excludeBookies, ITopologyAwareEnsemblePlacementPolicy.Predicate<T> predicate, ITopologyAwareEnsemblePlacementPolicy.Ensemble<T> ensemble, boolean fallbackToRandom)
Select a node from a given network location.T
selectFromNetworkLocation(java.util.Set<java.lang.String> excludeRacks, java.util.Set<Node> excludeBookies, ITopologyAwareEnsemblePlacementPolicy.Predicate<BookieNode> predicate, ITopologyAwareEnsemblePlacementPolicy.Ensemble<BookieNode> ensemble, boolean fallbackToRandom)
Select a node from cluster excluding excludeBookies and bookie nodes of excludeRacks.-
Methods inherited from interface org.apache.bookkeeper.client.EnsemblePlacementPolicy
areAckedBookiesAdheringToPlacementPolicy, getStickyReadBookieIndex, initialize, isEnsembleAdheringToPlacementPolicy, newEnsemble, onClusterChanged, registerSlowBookie, reorderReadLACSequence, reorderReadSequence, replaceBookie, replaceToAdherePlacementPolicy, uninitalize, updateBookieInfo
-
-
-
-
Method Detail
-
newEnsemble
EnsemblePlacementPolicy.PlacementResult<java.util.List<BookieId>> newEnsemble(int ensembleSize, int writeQuorumSize, int ackQuorumSize, java.util.Set<BookieId> excludeBookies, ITopologyAwareEnsemblePlacementPolicy.Ensemble<T> parentEnsemble, ITopologyAwareEnsemblePlacementPolicy.Predicate<T> parentPredicate) throws BKException.BKNotEnoughBookiesException
Create an ensemble with parent ensemble.- Parameters:
ensembleSize
- ensemble sizewriteQuorumSize
- write quorum sizeackQuorumSize
- ack quorum sizeexcludeBookies
- exclude bookiesparentEnsemble
- parent ensemble- Returns:
- list of bookies forming the ensemble
- Throws:
BKException.BKNotEnoughBookiesException
-
selectFromNetworkLocation
T selectFromNetworkLocation(java.lang.String networkLoc, java.util.Set<Node> excludeBookies, ITopologyAwareEnsemblePlacementPolicy.Predicate<T> predicate, ITopologyAwareEnsemblePlacementPolicy.Ensemble<T> ensemble, boolean fallbackToRandom) throws BKException.BKNotEnoughBookiesException
Select a node from a given network location.- Parameters:
networkLoc
- network locationexcludeBookies
- exclude bookies setpredicate
- predicate to applyensemble
- ensemblefallbackToRandom
- fallbackToRandom- Returns:
- the selected bookie.
- Throws:
BKException.BKNotEnoughBookiesException
-
selectFromNetworkLocation
T selectFromNetworkLocation(java.util.Set<java.lang.String> excludeRacks, java.util.Set<Node> excludeBookies, ITopologyAwareEnsemblePlacementPolicy.Predicate<BookieNode> predicate, ITopologyAwareEnsemblePlacementPolicy.Ensemble<BookieNode> ensemble, boolean fallbackToRandom) throws BKException.BKNotEnoughBookiesException
Select a node from cluster excluding excludeBookies and bookie nodes of excludeRacks. If there isn't a BookieNode excluding those racks and nodes, then if fallbackToRandom is set to true then pick a random node from cluster just excluding excludeBookies.- Parameters:
excludeRacks
-excludeBookies
-predicate
-ensemble
-fallbackToRandom
-- Returns:
- Throws:
BKException.BKNotEnoughBookiesException
-
selectFromNetworkLocation
T selectFromNetworkLocation(java.lang.String networkLoc, java.util.Set<java.lang.String> excludeRacks, java.util.Set<Node> excludeBookies, ITopologyAwareEnsemblePlacementPolicy.Predicate<BookieNode> predicate, ITopologyAwareEnsemblePlacementPolicy.Ensemble<BookieNode> ensemble, boolean fallbackToRandom) throws BKException.BKNotEnoughBookiesException
Select a node from networkLoc rack excluding excludeBookies. If there isn't any node in 'networkLoc', then it will try to get a node from cluster excluding excludeRacks and excludeBookies. If fallbackToRandom is set to true then it will get a random bookie from cluster excluding excludeBookies if it couldn't find a bookie- Parameters:
networkLoc
-excludeRacks
-excludeBookies
-predicate
-ensemble
-fallbackToRandom
-- Returns:
- Throws:
BKException.BKNotEnoughBookiesException
-
handleBookiesThatLeft
void handleBookiesThatLeft(java.util.Set<BookieId> leftBookies)
Handle bookies that left.- Parameters:
leftBookies
- bookies that left
-
handleBookiesThatJoined
void handleBookiesThatJoined(java.util.Set<BookieId> joinedBookies)
Handle bookies that joined.- Parameters:
joinedBookies
- bookies that joined.
-
onBookieRackChange
void onBookieRackChange(java.util.List<BookieId> bookieAddressList)
Handle rack change for the bookies.- Parameters:
bookieAddressList
-
-
-