Package org.apache.bookkeeper.net
Interface NetworkTopology
-
- All Known Implementing Classes:
NetworkTopologyImpl,StabilizeNetworkTopology
public interface NetworkTopologyNetwork Topology Interface.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_RACKstatic java.lang.StringDEFAULT_REGIONstatic java.lang.StringDEFAULT_REGION_AND_RACKstatic java.lang.StringDEFAULT_UPGRADEDOMAINstatic java.lang.StringDEFAULT_ZONEstatic java.lang.StringDEFAULT_ZONE_AND_UPGRADEDOMAIN
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidadd(Node node)Add a node to the network topology.booleancontains(Node node)Check if the tree contains node node.intcountNumOfAvailableNodes(java.lang.String scope, java.util.Collection<Node> excludedNodes)Return the number of leaves in scope but not in excludedNodes.java.util.Set<Node>getLeaves(java.lang.String loc)Returns the nodes under a location.NodegetNode(java.lang.String loc)Retrieve a node from the network topology.intgetNumOfRacks()Returns number of racks in the network topology.voidremove(Node node)Remove a node from network topology.
-
-
-
Field Detail
-
DEFAULT_REGION
static final java.lang.String DEFAULT_REGION
- See Also:
- Constant Field Values
-
DEFAULT_RACK
static final java.lang.String DEFAULT_RACK
- See Also:
- Constant Field Values
-
DEFAULT_ZONE
static final java.lang.String DEFAULT_ZONE
- See Also:
- Constant Field Values
-
DEFAULT_UPGRADEDOMAIN
static final java.lang.String DEFAULT_UPGRADEDOMAIN
- See Also:
- Constant Field Values
-
DEFAULT_ZONE_AND_UPGRADEDOMAIN
static final java.lang.String DEFAULT_ZONE_AND_UPGRADEDOMAIN
- See Also:
- Constant Field Values
-
DEFAULT_REGION_AND_RACK
static final java.lang.String DEFAULT_REGION_AND_RACK
- See Also:
- Constant Field Values
-
-
Method Detail
-
add
void add(Node node)
Add a node to the network topology.- Parameters:
node- add the node to network topology
-
remove
void remove(Node node)
Remove a node from network topology.- Parameters:
node- remove the node from network topology
-
contains
boolean contains(Node node)
Check if the tree contains node node.- Parameters:
node- node to check- Returns:
- true if node is already in the network topology, otherwise false.
-
getNode
Node getNode(java.lang.String loc)
Retrieve a node from the network topology.- Parameters:
loc-- Returns:
-
getNumOfRacks
int getNumOfRacks()
Returns number of racks in the network topology.- Returns:
- number of racks in the network topology.
-
getLeaves
java.util.Set<Node> getLeaves(java.lang.String loc)
Returns the nodes under a location.- Parameters:
loc- network location- Returns:
- nodes under a location
-
countNumOfAvailableNodes
int countNumOfAvailableNodes(java.lang.String scope, java.util.Collection<Node> excludedNodes)Return the number of leaves in scope but not in excludedNodes.If scope starts with ~, return the number of nodes that are not in scope and excludedNodes;
- Parameters:
scope- a path string that may start with ~excludedNodes- a list of nodes- Returns:
- number of available nodes
-
-