public class NamespaceBundleFactory extends Object implements ZooKeeperCacheListener<org.apache.pulsar.common.policies.data.LocalPolicies>
| Constructor and Description |
|---|
NamespaceBundleFactory(PulsarService pulsar,
com.google.common.hash.HashFunction hashFunc) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canSplitBundle(NamespaceBundle bundle) |
static NamespaceBundleFactory |
createFactory(PulsarService pulsar,
com.google.common.hash.HashFunction hashFunc) |
NamespaceBundle |
getBundle(org.apache.pulsar.common.naming.NamespaceName nsname,
com.google.common.collect.Range<Long> hashRange) |
NamespaceBundle |
getBundle(String namespace,
String bundleRange) |
NamespaceBundles |
getBundles(org.apache.pulsar.common.naming.NamespaceName nsname) |
NamespaceBundles |
getBundles(org.apache.pulsar.common.naming.NamespaceName nsname,
org.apache.pulsar.common.policies.data.BundlesData bundleData) |
NamespaceBundles |
getBundles(org.apache.pulsar.common.naming.NamespaceName nsname,
org.apache.pulsar.common.policies.data.BundlesData bundleData,
long version) |
CompletableFuture<NamespaceBundles> |
getBundlesAsync(org.apache.pulsar.common.naming.NamespaceName nsname) |
static org.apache.pulsar.common.policies.data.BundlesData |
getBundlesData(NamespaceBundles bundles) |
Optional<NamespaceBundles> |
getBundlesIfPresent(org.apache.pulsar.common.naming.NamespaceName nsname) |
static String |
getDefaultBundleRange() |
NamespaceBundle |
getFullBundle(org.apache.pulsar.common.naming.NamespaceName fqnn) |
CompletableFuture<NamespaceBundle> |
getFullBundleAsync(org.apache.pulsar.common.naming.NamespaceName fqnn) |
long |
getLongHashCode(String name) |
static String |
getNamespaceFromPoliciesPath(String path) |
void |
invalidateBundleCache(org.apache.pulsar.common.naming.NamespaceName namespace) |
static boolean |
isFullBundle(String bundleRange) |
void |
onUpdate(String path,
org.apache.pulsar.common.policies.data.LocalPolicies data,
org.apache.zookeeper.data.Stat stat) |
org.apache.commons.lang3.tuple.Pair<NamespaceBundles,List<NamespaceBundle>> |
splitBundles(NamespaceBundle targetBundle,
int numBundles,
Long splitBoundary)
Fetches
NamespaceBundles from cache for a given namespace. |
static void |
validateFullRange(SortedSet<String> partitions) |
public NamespaceBundleFactory(PulsarService pulsar, com.google.common.hash.HashFunction hashFunc)
public void onUpdate(String path, org.apache.pulsar.common.policies.data.LocalPolicies data, org.apache.zookeeper.data.Stat stat)
onUpdate in interface ZooKeeperCacheListener<org.apache.pulsar.common.policies.data.LocalPolicies>public void invalidateBundleCache(org.apache.pulsar.common.naming.NamespaceName namespace)
public CompletableFuture<NamespaceBundles> getBundlesAsync(org.apache.pulsar.common.naming.NamespaceName nsname)
public NamespaceBundles getBundles(org.apache.pulsar.common.naming.NamespaceName nsname) throws Exception
Exceptionpublic Optional<NamespaceBundles> getBundlesIfPresent(org.apache.pulsar.common.naming.NamespaceName nsname) throws Exception
Exceptionpublic NamespaceBundle getBundle(org.apache.pulsar.common.naming.NamespaceName nsname, com.google.common.collect.Range<Long> hashRange)
public NamespaceBundle getBundle(String namespace, String bundleRange)
public NamespaceBundle getFullBundle(org.apache.pulsar.common.naming.NamespaceName fqnn) throws Exception
Exceptionpublic CompletableFuture<NamespaceBundle> getFullBundleAsync(org.apache.pulsar.common.naming.NamespaceName fqnn) throws Exception
Exceptionpublic long getLongHashCode(String name)
public NamespaceBundles getBundles(org.apache.pulsar.common.naming.NamespaceName nsname, org.apache.pulsar.common.policies.data.BundlesData bundleData)
public NamespaceBundles getBundles(org.apache.pulsar.common.naming.NamespaceName nsname, org.apache.pulsar.common.policies.data.BundlesData bundleData, long version)
public static org.apache.pulsar.common.policies.data.BundlesData getBundlesData(NamespaceBundles bundles) throws Exception
Exceptionpublic org.apache.commons.lang3.tuple.Pair<NamespaceBundles,List<NamespaceBundle>> splitBundles(NamespaceBundle targetBundle, int numBundles, Long splitBoundary)
NamespaceBundles from cache for a given namespace. finds target bundle, split into numBundles and
returns new NamespaceBundles with newly split bundles into it.targetBundle - NamespaceBundle needs to be splitnumBundles - 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.NamespaceBundle and NamespaceBundles that contains final bundles including
split bundles for a given namespacepublic boolean canSplitBundle(NamespaceBundle bundle)
public static NamespaceBundleFactory createFactory(PulsarService pulsar, com.google.common.hash.HashFunction hashFunc)
public static boolean isFullBundle(String bundleRange)
public static String getDefaultBundleRange()
Copyright © 2017–2021 Apache Software Foundation. All rights reserved.