public class NamespaceService extends Object
NamespaceService provides resource ownership lookup as well as resource ownership claiming services
for the PulsarService.
The PulsarService relies on this service for resource ownership operations.
The focus of this phase is to bring up the system and be able to iterate and improve the services effectively.
PulsarService| Modifier and Type | Class and Description |
|---|---|
static class |
NamespaceService.AddressType |
| Modifier and Type | Field and Description |
|---|---|
static String |
HEARTBEAT_NAMESPACE_FMT |
static Pattern |
HEARTBEAT_NAMESPACE_PATTERN |
static String |
NAMESPACE_ISOLATION_POLICIES |
static String |
SLA_NAMESPACE_FMT |
static Pattern |
SLA_NAMESPACE_PATTERN |
static String |
SLA_NAMESPACE_PROPERTY |
| Constructor and Description |
|---|
NamespaceService(PulsarService pulsar)
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addNamespaceBundleOwnershipListener(NamespaceBundleOwnershipListener... listeners) |
static String |
checkHeartbeatNamespace(org.apache.pulsar.common.naming.ServiceUnitId ns) |
CompletableFuture<Boolean> |
checkTopicExists(org.apache.pulsar.common.naming.TopicName topic) |
CompletableFuture<Boolean> |
checkTopicOwnership(org.apache.pulsar.common.naming.TopicName topicName) |
protected CompletableFuture<LookupResult> |
createLookupResult(String candidateBroker,
boolean authoritativeRedirect,
String advertisedListenerName) |
CompletableFuture<List<String>> |
getAllPartitions(org.apache.pulsar.common.naming.NamespaceName namespaceName) |
CompletableFuture<Optional<LookupResult>> |
getBrokerServiceUrlAsync(org.apache.pulsar.common.naming.TopicName topic,
LookupOptions options) |
NamespaceBundle |
getBundle(org.apache.pulsar.common.naming.TopicName topicName) |
CompletableFuture<NamespaceBundle> |
getBundleAsync(org.apache.pulsar.common.naming.TopicName topic) |
int |
getBundleCount(org.apache.pulsar.common.naming.NamespaceName namespace) |
Optional<NamespaceBundle> |
getBundleIfPresent(org.apache.pulsar.common.naming.TopicName topicName) |
CompletableFuture<List<String>> |
getFullListOfTopics(org.apache.pulsar.common.naming.NamespaceName namespaceName) |
static String |
getHeartbeatNamespace(String host,
ServiceConfiguration config) |
CompletableFuture<List<String>> |
getListOfNonPersistentTopics(org.apache.pulsar.common.naming.NamespaceName namespaceName) |
CompletableFuture<List<String>> |
getListOfPersistentTopics(org.apache.pulsar.common.naming.NamespaceName namespaceName) |
CompletableFuture<List<String>> |
getListOfTopics(org.apache.pulsar.common.naming.NamespaceName namespaceName,
org.apache.pulsar.common.api.proto.PulsarApi.CommandGetTopicsOfNamespace.Mode mode) |
NamespaceBundleFactory |
getNamespaceBundleFactory() |
PulsarClientImpl |
getNamespaceClient(org.apache.pulsar.common.policies.data.ClusterData cluster) |
Map<String,org.apache.pulsar.common.policies.data.NamespaceOwnershipStatus> |
getOwnedNameSpacesStatus() |
Set<NamespaceBundle> |
getOwnedServiceUnits() |
CompletableFuture<List<String>> |
getOwnedTopicListForNamespaceBundle(NamespaceBundle bundle) |
Optional<NamespaceEphemeralData> |
getOwner(NamespaceBundle bundle) |
CompletableFuture<Optional<NamespaceEphemeralData>> |
getOwnerAsync(NamespaceBundle bundle) |
OwnershipCache |
getOwnershipCache() |
CompletableFuture<List<String>> |
getPartitions(org.apache.pulsar.common.naming.NamespaceName namespaceName,
org.apache.pulsar.common.naming.TopicDomain topicDomain) |
org.apache.pulsar.common.naming.ServiceUnitId |
getServiceUnitId(org.apache.pulsar.common.naming.TopicName topicName) |
static String |
getSLAMonitorBrokerName(org.apache.pulsar.common.naming.ServiceUnitId ns) |
static String |
getSLAMonitorNamespace(String host,
ServiceConfiguration config) |
int |
getTotalServiceUnitsLoaded() |
Optional<URL> |
getWebServiceUrl(org.apache.pulsar.common.naming.ServiceUnitId suName,
LookupOptions options)
Return the URL of the broker who's owning a particular service unit.
|
CompletableFuture<Optional<URL>> |
getWebServiceUrlAsync(org.apache.pulsar.common.naming.ServiceUnitId suName,
LookupOptions options)
Return the URL of the broker who's owning a particular service unit in asynchronous way
If the service unit is not owned, return a CompletableFuture with empty optional.
|
void |
initialize() |
boolean |
isNamespaceBundleDisabled(NamespaceBundle bundle) |
CompletableFuture<Boolean> |
isNamespaceBundleOwned(NamespaceBundle bundle) |
boolean |
isServiceUnitActive(org.apache.pulsar.common.naming.TopicName topicName) |
boolean |
isServiceUnitOwned(org.apache.pulsar.common.naming.ServiceUnitId suName) |
protected void |
onNamespaceBundleOwned(NamespaceBundle bundle) |
protected void |
onNamespaceBundleUnload(NamespaceBundle bundle) |
void |
registerBootstrapNamespaces()
Register all the bootstrap name spaces including the heartbeat namespace
|
boolean |
registerNamespace(String namespace,
boolean ensureOwned)
Tried to registers a namespace to this instance
|
void |
registerOwnedBundles() |
boolean |
registerSLANamespace() |
void |
removeOwnedServiceUnit(NamespaceBundle nsBundle) |
void |
removeOwnedServiceUnit(org.apache.pulsar.common.naming.NamespaceName nsName) |
void |
removeOwnedServiceUnits(org.apache.pulsar.common.naming.NamespaceName nsName,
org.apache.pulsar.common.policies.data.BundlesData bundleData) |
CompletableFuture<Void> |
splitAndOwnBundle(NamespaceBundle bundle,
boolean unload,
NamespaceBundleSplitAlgorithm splitAlgorithm)
1.
|
CompletableFuture<Void> |
unloadNamespaceBundle(NamespaceBundle bundle) |
CompletableFuture<Void> |
unloadNamespaceBundle(NamespaceBundle bundle,
long timeout,
TimeUnit timeoutUnit) |
void |
unloadSLANamespace() |
public static final String SLA_NAMESPACE_PROPERTY
public static final Pattern HEARTBEAT_NAMESPACE_PATTERN
public static final Pattern SLA_NAMESPACE_PATTERN
public static final String HEARTBEAT_NAMESPACE_FMT
public static final String SLA_NAMESPACE_FMT
public static final String NAMESPACE_ISOLATION_POLICIES
public NamespaceService(PulsarService pulsar)
PulsarServerExceptionpublic void initialize()
public CompletableFuture<Optional<LookupResult>> getBrokerServiceUrlAsync(org.apache.pulsar.common.naming.TopicName topic, LookupOptions options)
public CompletableFuture<NamespaceBundle> getBundleAsync(org.apache.pulsar.common.naming.TopicName topic)
public Optional<NamespaceBundle> getBundleIfPresent(org.apache.pulsar.common.naming.TopicName topicName) throws Exception
Exceptionpublic NamespaceBundle getBundle(org.apache.pulsar.common.naming.TopicName topicName) throws Exception
Exceptionpublic int getBundleCount(org.apache.pulsar.common.naming.NamespaceName namespace)
throws Exception
Exceptionpublic CompletableFuture<Optional<URL>> getWebServiceUrlAsync(org.apache.pulsar.common.naming.ServiceUnitId suName, LookupOptions options) throws Exception
Exceptionpublic Optional<URL> getWebServiceUrl(org.apache.pulsar.common.naming.ServiceUnitId suName, LookupOptions options) throws Exception
Exceptionpublic void registerBootstrapNamespaces()
throws PulsarServerException
PulsarServerExceptionpublic boolean registerNamespace(String namespace, boolean ensureOwned) throws PulsarServerException
namespace - ensureOwned - PulsarServerExceptionExceptionprotected CompletableFuture<LookupResult> createLookupResult(String candidateBroker, boolean authoritativeRedirect, String advertisedListenerName) throws Exception
Exceptionpublic CompletableFuture<Void> unloadNamespaceBundle(NamespaceBundle bundle)
public CompletableFuture<Void> unloadNamespaceBundle(NamespaceBundle bundle, long timeout, TimeUnit timeoutUnit)
public CompletableFuture<Boolean> isNamespaceBundleOwned(NamespaceBundle bundle)
public Map<String,org.apache.pulsar.common.policies.data.NamespaceOwnershipStatus> getOwnedNameSpacesStatus() throws Exception
Exceptionpublic boolean isNamespaceBundleDisabled(NamespaceBundle bundle) throws Exception
Exceptionpublic CompletableFuture<Void> splitAndOwnBundle(NamespaceBundle bundle, boolean unload, NamespaceBundleSplitAlgorithm splitAlgorithm) throws Exception
bundle - Exceptionpublic OwnershipCache getOwnershipCache()
public int getTotalServiceUnitsLoaded()
public Set<NamespaceBundle> getOwnedServiceUnits()
public boolean isServiceUnitOwned(org.apache.pulsar.common.naming.ServiceUnitId suName)
throws Exception
Exceptionpublic boolean isServiceUnitActive(org.apache.pulsar.common.naming.TopicName topicName)
public CompletableFuture<Boolean> checkTopicOwnership(org.apache.pulsar.common.naming.TopicName topicName)
public void removeOwnedServiceUnit(org.apache.pulsar.common.naming.NamespaceName nsName)
throws Exception
Exceptionpublic void removeOwnedServiceUnit(NamespaceBundle nsBundle) throws Exception
Exceptionpublic void removeOwnedServiceUnits(org.apache.pulsar.common.naming.NamespaceName nsName,
org.apache.pulsar.common.policies.data.BundlesData bundleData)
throws Exception
Exceptionprotected void onNamespaceBundleOwned(NamespaceBundle bundle)
protected void onNamespaceBundleUnload(NamespaceBundle bundle)
public void addNamespaceBundleOwnershipListener(NamespaceBundleOwnershipListener... listeners)
public NamespaceBundleFactory getNamespaceBundleFactory()
public org.apache.pulsar.common.naming.ServiceUnitId getServiceUnitId(org.apache.pulsar.common.naming.TopicName topicName)
throws Exception
Exceptionpublic CompletableFuture<List<String>> getFullListOfTopics(org.apache.pulsar.common.naming.NamespaceName namespaceName)
public CompletableFuture<List<String>> getOwnedTopicListForNamespaceBundle(NamespaceBundle bundle)
public CompletableFuture<Boolean> checkTopicExists(org.apache.pulsar.common.naming.TopicName topic)
public CompletableFuture<List<String>> getListOfTopics(org.apache.pulsar.common.naming.NamespaceName namespaceName, org.apache.pulsar.common.api.proto.PulsarApi.CommandGetTopicsOfNamespace.Mode mode)
public CompletableFuture<List<String>> getAllPartitions(org.apache.pulsar.common.naming.NamespaceName namespaceName)
public CompletableFuture<List<String>> getPartitions(org.apache.pulsar.common.naming.NamespaceName namespaceName, org.apache.pulsar.common.naming.TopicDomain topicDomain)
public CompletableFuture<List<String>> getListOfPersistentTopics(org.apache.pulsar.common.naming.NamespaceName namespaceName)
public CompletableFuture<List<String>> getListOfNonPersistentTopics(org.apache.pulsar.common.naming.NamespaceName namespaceName)
public PulsarClientImpl getNamespaceClient(org.apache.pulsar.common.policies.data.ClusterData cluster)
public Optional<NamespaceEphemeralData> getOwner(NamespaceBundle bundle) throws Exception
Exceptionpublic CompletableFuture<Optional<NamespaceEphemeralData>> getOwnerAsync(NamespaceBundle bundle)
public static String getHeartbeatNamespace(String host, ServiceConfiguration config)
public static String getSLAMonitorNamespace(String host, ServiceConfiguration config)
public static String checkHeartbeatNamespace(org.apache.pulsar.common.naming.ServiceUnitId ns)
public static String getSLAMonitorBrokerName(org.apache.pulsar.common.naming.ServiceUnitId ns)
public boolean registerSLANamespace()
throws PulsarServerException
PulsarServerExceptionpublic void registerOwnedBundles()
Copyright © 2017–2021 Apache Software Foundation. All rights reserved.