Interface NamespaceIsolationPolicy

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.List<java.net.URL> findPrimaryBrokers​(java.util.List<java.net.URL> availableBrokers, NamespaceName namespace)
      Get the list of primary brokers for the namespace according to the policy.
      java.util.List<java.net.URL> findSecondaryBrokers​(java.util.List<java.net.URL> availableBrokers, NamespaceName namespace)
      Get the list of secondary brokers for the namespace according to the policy.
      java.util.SortedSet<org.apache.pulsar.common.policies.data.BrokerStatus> getAvailablePrimaryBrokers​(java.util.SortedSet<org.apache.pulsar.common.policies.data.BrokerStatus> primaryCandidates)
      According to the namespace isolation policy, find the allowed available primary brokers.
      java.util.List<java.lang.String> getPrimaryBrokers()
      Get the list of regex for the set of primary brokers.
      java.util.List<java.lang.String> getSecondaryBrokers()
      Get the list of regex for the set of secondary brokers.
      boolean isPrimaryBroker​(java.lang.String brokerAddress)
      Check to see whether the specific host is a primary broker.
      boolean isPrimaryBrokerAvailable​(org.apache.pulsar.common.policies.data.BrokerStatus brkStatus)  
      boolean isSecondaryBroker​(java.lang.String brokerAddress)
      Check to see whether the specific host is a secondary broker.
      boolean shouldFailover​(int totalPrimaryCandidates)
      Check to see whether the primary brokers can still handle a new namespace or has to failover.
      boolean shouldFailover​(java.util.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.
      boolean shouldFallback​(java.util.SortedSet<org.apache.pulsar.common.policies.data.BrokerStatus> primaryBrokers)
      Check to see whether the namespace ownership should fallback to the primary brokers.
    • Method Detail

      • getPrimaryBrokers

        java.util.List<java.lang.String> getPrimaryBrokers()
        Get the list of regex for the set of primary brokers.
        Returns:
      • getSecondaryBrokers

        java.util.List<java.lang.String> getSecondaryBrokers()
        Get the list of regex for the set of secondary brokers.
        Returns:
      • findPrimaryBrokers

        java.util.List<java.net.URL> findPrimaryBrokers​(java.util.List<java.net.URL> availableBrokers,
                                                        NamespaceName namespace)
        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

        java.util.List<java.net.URL> findSecondaryBrokers​(java.util.List<java.net.URL> availableBrokers,
                                                          NamespaceName namespace)
        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​(java.util.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​(java.util.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

        boolean isPrimaryBroker​(java.lang.String brokerAddress)
        Check to see whether the specific host is a primary broker.
        Parameters:
        brokerAddress -
        Returns:
      • isSecondaryBroker

        boolean isSecondaryBroker​(java.lang.String brokerAddress)
        Check to see whether the specific host is a secondary broker.
        Parameters:
        brokerAddress -
        Returns:
      • getAvailablePrimaryBrokers

        java.util.SortedSet<org.apache.pulsar.common.policies.data.BrokerStatus> getAvailablePrimaryBrokers​(java.util.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)