Interface NamespaceIsolationPolicy
- All Known Implementing Classes:
NamespaceIsolationPolicyImpl
public interface NamespaceIsolationPolicy
Namespace isolation policy.
-
Method Summary
Modifier and TypeMethodDescriptionfindPrimaryBrokers(List<URL> availableBrokers, NamespaceName namespace) Get the list of primary brokers for the namespace according to the policy.findSecondaryBrokers(List<URL> availableBrokers, NamespaceName namespace) Get the list of secondary brokers for the namespace according to the policy.SortedSet<org.apache.pulsar.common.policies.data.BrokerStatus>getAvailablePrimaryBrokers(SortedSet<org.apache.pulsar.common.policies.data.BrokerStatus> primaryCandidates) According to the namespace isolation policy, find the allowed available primary brokers.Get the list of regex for the set of primary brokers.Get the list of regex for the set of secondary brokers.booleanisPrimaryBroker(String brokerAddress) Check to see whether the specific host is a primary broker.booleanisPrimaryBrokerAvailable(org.apache.pulsar.common.policies.data.BrokerStatus brkStatus) booleanisSecondaryBroker(String brokerAddress) Check to see whether the specific host is a secondary broker.booleanshouldFailover(int totalPrimaryCandidates) Check to see whether the primary brokers can still handle a new namespace or has to failover.booleanshouldFailover(SortedSet<org.apache.pulsar.common.policies.data.BrokerStatus> primaryCandidates) Check to see whether the primary brokers can still handle a new namespace or has to failover.booleanshouldFallback(SortedSet<org.apache.pulsar.common.policies.data.BrokerStatus> primaryBrokers) Check to see whether the namespace ownership should fallback to the primary brokers.
-
Method Details
-
getPrimaryBrokers
Get the list of regex for the set of primary brokers.- Returns:
-
getSecondaryBrokers
Get the list of regex for the set of secondary brokers.- Returns:
-
findPrimaryBrokers
Get the list of primary brokers for the namespace according to the policy.- Parameters:
availableBrokers- brokers identified by service URL.namespace- the namespace- Returns:
- a list brokers by service URL.
-
findSecondaryBrokers
Get the list of secondary brokers for the namespace according to the policy.- Parameters:
availableBrokers- brokers identified by service URL.namespace- the namespace- Returns:
- a list brokers by service URL.
-
shouldFailover
boolean shouldFailover(SortedSet<org.apache.pulsar.common.policies.data.BrokerStatus> primaryCandidates) Check to see whether the primary brokers can still handle a new namespace or has to failover.- Parameters:
primaryCandidates-- Returns:
-
shouldFailover
boolean shouldFailover(int totalPrimaryCandidates) Check to see whether the primary brokers can still handle a new namespace or has to failover.- Parameters:
totalPrimaryCandidates-- Returns:
-
shouldFallback
boolean shouldFallback(SortedSet<org.apache.pulsar.common.policies.data.BrokerStatus> primaryBrokers) Check to see whether the namespace ownership should fallback to the primary brokers.- Parameters:
primaryBrokers-- Returns:
-
isPrimaryBroker
Check to see whether the specific host is a primary broker.- Parameters:
brokerAddress-- Returns:
-
isSecondaryBroker
Check to see whether the specific host is a secondary broker.- Parameters:
brokerAddress-- Returns:
-
getAvailablePrimaryBrokers
SortedSet<org.apache.pulsar.common.policies.data.BrokerStatus> getAvailablePrimaryBrokers(SortedSet<org.apache.pulsar.common.policies.data.BrokerStatus> primaryCandidates) According to the namespace isolation policy, find the allowed available primary brokers.- Parameters:
primaryCandidates-- Returns:
-
isPrimaryBrokerAvailable
boolean isPrimaryBrokerAvailable(org.apache.pulsar.common.policies.data.BrokerStatus brkStatus)
-