use of com.yahoo.pulsar.common.policies.data.BrokerAssignment in project pulsar by yahoo.
the class NamespaceIsolationPolicies method assignBroker.
public void assignBroker(NamespaceName nsname, BrokerStatus brkStatus, SortedSet<BrokerStatus> primaryCandidates, SortedSet<BrokerStatus> secondaryCandidates, SortedSet<BrokerStatus> sharedCandidates) {
NamespaceIsolationPolicy nsPolicy = this.getPolicyByNamespace(nsname);
BrokerAssignment brokerAssignment = this.getBrokerAssignment(nsPolicy, brkStatus.getBrokerAddress());
if (brokerAssignment == BrokerAssignment.primary) {
// Only add to candidates if allowed by policy
if (nsPolicy.isPrimaryBrokerAvailable(brkStatus)) {
primaryCandidates.add(brkStatus);
}
} else if (brokerAssignment == BrokerAssignment.secondary) {
secondaryCandidates.add(brkStatus);
} else if (brokerAssignment == BrokerAssignment.shared) {
sharedCandidates.add(brkStatus);
}
}
Aggregations