@InterfaceAudience.Public @InterfaceStability.Stable public interface BaseContext
| Modifier and Type | Method and Description |
|---|---|
void |
deleteState(String key)
Delete the state value for the key.
|
CompletableFuture<Void> |
deleteStateAsync(String key)
Delete the state value for the key, but don't wait for the operation to be completed
|
long |
getCounter(String key)
Retrieve the counter value for the key.
|
CompletableFuture<Long> |
getCounterAsync(String key)
Retrieve the counter value for the key, but don't wait
for the operation to be completed
|
int |
getInstanceId()
The id of the instance that invokes this component.
|
org.slf4j.Logger |
getLogger()
The logger object that can be used to log in a component.
|
String |
getNamespace()
The namespace this component belongs to.
|
int |
getNumInstances()
Get the number of instances that invoke this component.
|
default PulsarClient |
getPulsarClient()
Get the pulsar client.
|
String |
getSecret(String secretName)
Get the secret associated with this key.
|
ByteBuffer |
getState(String key)
Retrieve the state value for the key.
|
CompletableFuture<ByteBuffer> |
getStateAsync(String key)
Retrieve the state value for the key, but don't wait for the operation to be completed
|
default <S extends StateStore> |
getStateStore(String name)
Get the state store with the provided store name in the tenant & namespace.
|
default <S extends StateStore> |
getStateStore(String tenant,
String ns,
String name)
Get the state store with the provided store name.
|
String |
getTenant()
The tenant this component belongs to.
|
void |
incrCounter(String key,
long amount)
Increment the builtin distributed counter referred by key.
|
CompletableFuture<Void> |
incrCounterAsync(String key,
long amount)
Increment the builtin distributed counter referred by key
but dont wait for the completion of the increment operation
|
void |
putState(String key,
ByteBuffer value)
Update the state value for the key.
|
CompletableFuture<Void> |
putStateAsync(String key,
ByteBuffer value)
Update the state value for the key, but don't wait for the operation to be completed
|
void |
recordMetric(String metricName,
double value)
Record a user defined metric
|
String getTenant()
String getNamespace()
int getInstanceId()
int getNumInstances()
org.slf4j.Logger getLogger()
String getSecret(String secretName)
secretName - The name of the secretdefault <S extends StateStore> S getStateStore(String name)
S - the type of interface of the store to returnname - the state store nameClassCastException - if the return type isn't a type
or interface of the actual returned store.default <S extends StateStore> S getStateStore(String tenant, String ns, String name)
S - the type of interface of the store to returntenant - the state tenant namens - the state namespace namename - the state store nameClassCastException - if the return type isn't a type
or interface of the actual returned store.void putState(String key, ByteBuffer value)
key - name of the keyvalue - state value of the keyCompletableFuture<Void> putStateAsync(String key, ByteBuffer value)
key - name of the keyvalue - state value of the keyByteBuffer getState(String key)
key - name of the keyCompletableFuture<ByteBuffer> getStateAsync(String key)
key - name of the keyvoid deleteState(String key)
key - name of the keyCompletableFuture<Void> deleteStateAsync(String key)
key - name of the keyvoid incrCounter(String key, long amount)
key - The name of the keyamount - The amount to be incrementedCompletableFuture<Void> incrCounterAsync(String key, long amount)
key - The name of the keyamount - The amount to be incrementedlong getCounter(String key)
key - name of the keyCompletableFuture<Long> getCounterAsync(String key)
key - name of the keyvoid recordMetric(String metricName, double value)
metricName - The name of the metricvalue - The value of the metricdefault PulsarClient getPulsarClient()
Copyright © 2017–2021 Apache Software Foundation. All rights reserved.