Class NamespaceBundleFactory


  • public class NamespaceBundleFactory
    extends java.lang.Object
    • Constructor Detail

      • NamespaceBundleFactory

        public NamespaceBundleFactory​(PulsarService pulsar,
                                      com.google.common.hash.HashFunction hashFunc)
    • Method Detail

      • invalidateBundleCache

        public void invalidateBundleCache​(org.apache.pulsar.common.naming.NamespaceName namespace)
      • getBundlesAsync

        public java.util.concurrent.CompletableFuture<NamespaceBundles> getBundlesAsync​(org.apache.pulsar.common.naming.NamespaceName nsname)
      • getBundleWithHighestTopics

        public NamespaceBundle getBundleWithHighestTopics​(org.apache.pulsar.common.naming.NamespaceName nsname)
      • getBundleWithHighestTopicsAsync

        public java.util.concurrent.CompletableFuture<NamespaceBundle> getBundleWithHighestTopicsAsync​(org.apache.pulsar.common.naming.NamespaceName nsname)
      • getBundle

        public NamespaceBundle getBundle​(org.apache.pulsar.common.naming.TopicName topic)
      • getBundleWithHighestThroughput

        public NamespaceBundle getBundleWithHighestThroughput​(org.apache.pulsar.common.naming.NamespaceName nsName)
      • getBundles

        public NamespaceBundles getBundles​(org.apache.pulsar.common.naming.NamespaceName nsname)
      • getBundlesIfPresent

        public java.util.Optional<NamespaceBundles> getBundlesIfPresent​(org.apache.pulsar.common.naming.NamespaceName nsname)
      • getBundle

        public NamespaceBundle getBundle​(org.apache.pulsar.common.naming.NamespaceName nsname,
                                         com.google.common.collect.Range<java.lang.Long> hashRange)
      • getBundle

        public NamespaceBundle getBundle​(java.lang.String namespace,
                                         java.lang.String bundleRange)
      • getFullBundle

        public NamespaceBundle getFullBundle​(org.apache.pulsar.common.naming.NamespaceName fqnn)
                                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getFullBundleAsync

        public java.util.concurrent.CompletableFuture<NamespaceBundle> getFullBundleAsync​(org.apache.pulsar.common.naming.NamespaceName fqnn)
      • getLongHashCode

        public long getLongHashCode​(java.lang.String name)
      • getBundles

        public NamespaceBundles getBundles​(org.apache.pulsar.common.naming.NamespaceName nsname,
                                           org.apache.pulsar.common.policies.data.BundlesData bundleData)
      • splitBundles

        public java.util.concurrent.CompletableFuture<org.apache.commons.lang3.tuple.Pair<NamespaceBundles,​java.util.List<NamespaceBundle>>> splitBundles​(NamespaceBundle targetBundle,
                                                                                                                                                                int argNumBundles,
                                                                                                                                                                java.lang.Long splitBoundary)
        Fetches NamespaceBundles from cache for a given namespace. finds target bundle, split into numBundles and returns new NamespaceBundles with newly split bundles into it.
        Parameters:
        targetBundle - NamespaceBundle needs to be split
        argNumBundles - split into numBundles
        splitBoundary - split into 2 numBundles by the given split key. The given split key must between the key range of the given split bundle.
        Returns:
        List of split NamespaceBundle and NamespaceBundles that contains final bundles including split bundles for a given namespace
      • canSplitBundle

        public boolean canSplitBundle​(NamespaceBundle bundle)
      • validateFullRange

        public static void validateFullRange​(java.util.SortedSet<java.lang.String> partitions)
      • isFullBundle

        public static boolean isFullBundle​(java.lang.String bundleRange)
      • getDefaultBundleRange

        public static java.lang.String getDefaultBundleRange()
      • getNamespaceFromPoliciesPath

        public static java.lang.String getNamespaceFromPoliciesPath​(java.lang.String path)