public class FunctionMetaDataManager extends Object implements AutoCloseable
| Constructor and Description |
|---|
FunctionMetaDataManager(WorkerConfig workerConfig,
SchedulerManager schedulerManager,
org.apache.pulsar.client.api.PulsarClient pulsarClient,
ErrorNotifier errorNotifier) |
| Modifier and Type | Method and Description |
|---|---|
org.apache.pulsar.client.api.Producer<byte[]> |
acquireExclusiveWrite(Supplier<Boolean> isLeader)
Acquires a exclusive producer.
|
void |
acquireLeadership(org.apache.pulsar.client.api.Producer<byte[]> exclusiveProducer)
Called by the leader service when this worker becomes the leader.
|
void |
close() |
boolean |
containsFunction(String tenant,
String namespace,
String functionName)
Check if the function exists.
|
List<org.apache.pulsar.functions.proto.Function.FunctionMetaData> |
getAllFunctionMetaData()
Get a list of all the meta for every function.
|
org.apache.pulsar.functions.proto.Function.FunctionMetaData |
getFunctionMetaData(String tenant,
String namespace,
String functionName)
Get the function metadata for a function.
|
void |
giveupLeadership()
called by the leader service when we lose leadership.
|
void |
initialize()
Initializes the FunctionMetaDataManager.
|
Collection<org.apache.pulsar.functions.proto.Function.FunctionMetaData> |
listFunctions(String tenant,
String namespace)
List all the functions in a namespace.
|
void |
processMetaDataTopicMessage(org.apache.pulsar.client.api.Message<byte[]> message)
This is called by the MetaData tailer.
|
void |
start() |
void |
updateFunctionOnLeader(org.apache.pulsar.functions.proto.Function.FunctionMetaData functionMetaData,
boolean delete)
Called by the worker when we are in the leader mode.
|
public FunctionMetaDataManager(WorkerConfig workerConfig, SchedulerManager schedulerManager, org.apache.pulsar.client.api.PulsarClient pulsarClient, ErrorNotifier errorNotifier) throws org.apache.pulsar.client.api.PulsarClientException
org.apache.pulsar.client.api.PulsarClientExceptionpublic void initialize()
public void start()
public void close()
throws Exception
close in interface AutoCloseableExceptionpublic org.apache.pulsar.functions.proto.Function.FunctionMetaData getFunctionMetaData(String tenant, String namespace, String functionName)
tenant - the tenant the function belongs tonamespace - the namespace the function belongs tofunctionName - the function namepublic List<org.apache.pulsar.functions.proto.Function.FunctionMetaData> getAllFunctionMetaData()
public Collection<org.apache.pulsar.functions.proto.Function.FunctionMetaData> listFunctions(String tenant, String namespace)
tenant - the tenant the namespace belongs tonamespace - the namespacepublic boolean containsFunction(String tenant, String namespace, String functionName)
tenant - tenant that the function belongs tonamespace - namespace that the function belongs tofunctionName - name of functionpublic void updateFunctionOnLeader(org.apache.pulsar.functions.proto.Function.FunctionMetaData functionMetaData, boolean delete) throws IllegalStateException, IllegalArgumentException
functionMetaData - The function metadata in questiondelete - Is this a delete operationIllegalStateException - if we are not the leaderIllegalArgumentException - if the request is out of date.public org.apache.pulsar.client.api.Producer<byte[]> acquireExclusiveWrite(Supplier<Boolean> isLeader) throws WorkerUtils.NotLeaderAnymore
isLeader - if the worker is still the leaderWorkerUtils.NotLeaderAnymore - if the worker is no longer the leader.public void acquireLeadership(org.apache.pulsar.client.api.Producer<byte[]> exclusiveProducer)
public void giveupLeadership()
public void processMetaDataTopicMessage(org.apache.pulsar.client.api.Message<byte[]> message)
throws IOException
message - The message read from metadata topic that needs to be processedIOExceptionCopyright © 2017–2022 Apache Software Foundation. All rights reserved.