Package org.apache.pulsar.common.naming
Class NamespaceBundleFactory
- java.lang.Object
-
- org.apache.pulsar.common.naming.NamespaceBundleFactory
-
public class NamespaceBundleFactory extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description NamespaceBundleFactory(PulsarService pulsar, com.google.common.hash.HashFunction hashFunc)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanSplitBundle(NamespaceBundle bundle)static NamespaceBundleFactorycreateFactory(PulsarService pulsar, com.google.common.hash.HashFunction hashFunc)NamespaceBundlegetBundle(java.lang.String namespace, java.lang.String bundleRange)NamespaceBundlegetBundle(org.apache.pulsar.common.naming.NamespaceName nsname, com.google.common.collect.Range<java.lang.Long> hashRange)NamespaceBundlesgetBundles(org.apache.pulsar.common.naming.NamespaceName nsname)NamespaceBundlesgetBundles(org.apache.pulsar.common.naming.NamespaceName nsname, org.apache.pulsar.common.policies.data.BundlesData bundleData)java.util.concurrent.CompletableFuture<NamespaceBundles>getBundlesAsync(org.apache.pulsar.common.naming.NamespaceName nsname)java.util.Optional<NamespaceBundles>getBundlesIfPresent(org.apache.pulsar.common.naming.NamespaceName nsname)NamespaceBundlegetBundlesWithHighestTopics(org.apache.pulsar.common.naming.NamespaceName nsname)java.util.concurrent.CompletableFuture<NamespaceBundle>getBundlesWithHighestTopicsAsync(org.apache.pulsar.common.naming.NamespaceName nsname)static java.lang.StringgetDefaultBundleRange()NamespaceBundlegetFullBundle(org.apache.pulsar.common.naming.NamespaceName fqnn)java.util.concurrent.CompletableFuture<NamespaceBundle>getFullBundleAsync(org.apache.pulsar.common.naming.NamespaceName fqnn)longgetLongHashCode(java.lang.String name)static java.lang.StringgetNamespaceFromPoliciesPath(java.lang.String path)voidinvalidateBundleCache(org.apache.pulsar.common.naming.NamespaceName namespace)static booleanisFullBundle(java.lang.String bundleRange)java.util.concurrent.CompletableFuture<org.apache.commons.lang3.tuple.Pair<NamespaceBundles,java.util.List<NamespaceBundle>>>splitBundles(NamespaceBundle targetBundle, int argNumBundles, java.lang.Long splitBoundary)FetchesNamespaceBundlesfrom cache for a given namespace.static voidvalidateFullRange(java.util.SortedSet<java.lang.String> partitions)
-
-
-
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)
-
getBundlesWithHighestTopics
public NamespaceBundle getBundlesWithHighestTopics(org.apache.pulsar.common.naming.NamespaceName nsname)
-
getBundlesWithHighestTopicsAsync
public java.util.concurrent.CompletableFuture<NamespaceBundle> getBundlesWithHighestTopicsAsync(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)
FetchesNamespaceBundlesfrom cache for a given namespace. finds target bundle, split into numBundles and returns newNamespaceBundleswith newly split bundles into it.- Parameters:
targetBundle-NamespaceBundleneeds to be splitargNumBundles- split into numBundlessplitBoundary- 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
NamespaceBundleandNamespaceBundlesthat 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)
-
createFactory
public static NamespaceBundleFactory createFactory(PulsarService pulsar, com.google.common.hash.HashFunction hashFunc)
-
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)
-
-