Module io.github.bucket4j.core
Class AsyncProxyManagerView<K,OldKey>
- java.lang.Object
-
- io.github.bucket4j.distributed.proxy.AsyncProxyManagerView<K,OldKey>
-
- All Implemented Interfaces:
AsyncProxyManager<K>
public class AsyncProxyManagerView<K,OldKey> extends Object implements AsyncProxyManager<K>
-
-
Constructor Summary
Constructors Constructor Description AsyncProxyManagerView(AsyncProxyManager<OldKey> target, Function<K,OldKey> mapper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RemoteAsyncBucketBuilder<K>builder()Creates new instance ofRemoteAsyncBucketBuilderAsyncBucketProxygetProxy(K key, Supplier<CompletableFuture<BucketConfiguration>> configurationSupplier)Creates bucket-proxy that configured by default parameters that set on proxy-manager level.CompletableFuture<Optional<BucketConfiguration>>getProxyConfiguration(K key)Asynchronously locates configuration of bucket which actually stored in the underlying storage.CompletableFuture<Void>removeProxy(K key)Asynchronously removes persisted state of bucket from underlying storage.<K2> AsyncProxyManager<K2>withMapper(Function<? super K2,? extends K> innerMapper)Returns a proxy object that wraps this AsyncProxyManager such that keys are first mapped using the specified mapping function before being sent to the remote store.
-
-
-
Constructor Detail
-
AsyncProxyManagerView
public AsyncProxyManagerView(AsyncProxyManager<OldKey> target, Function<K,OldKey> mapper)
-
-
Method Detail
-
getProxy
public AsyncBucketProxy getProxy(K key, Supplier<CompletableFuture<BucketConfiguration>> configurationSupplier)
Description copied from interface:AsyncProxyManagerCreates bucket-proxy that configured by default parameters that set on proxy-manager level.In case if you need to configure something special for bucket like implicit config replacement you should to use
AsyncProxyManager.builder()instead of this method.- Specified by:
getProxyin interfaceAsyncProxyManager<K>- Parameters:
key- the key that used in external storage to distinguish one bucket from another.configurationSupplier- provider for bucket configuration- Returns:
- new instance of
AsyncBucketProxy
-
builder
public RemoteAsyncBucketBuilder<K> builder()
Description copied from interface:AsyncProxyManagerCreates new instance ofRemoteAsyncBucketBuilderUse this method only if you need to create bucket with parameters that can not be specified via
AbstractProxyManagerBuilder, otherwise preferAsyncProxyManager.getProxy(Object, Supplier)- Specified by:
builderin interfaceAsyncProxyManager<K>- Returns:
- new instance of
RemoteAsyncBucketBuilder
-
removeProxy
public CompletableFuture<Void> removeProxy(K key)
Description copied from interface:AsyncProxyManagerAsynchronously removes persisted state of bucket from underlying storage.- Specified by:
removeProxyin interfaceAsyncProxyManager<K>- Parameters:
key- the primary key of bucket which state need to be removed from underlying storage.- Returns:
- the future that will be completed after deletion
-
getProxyConfiguration
public CompletableFuture<Optional<BucketConfiguration>> getProxyConfiguration(K key)
Description copied from interface:AsyncProxyManagerAsynchronously locates configuration of bucket which actually stored in the underlying storage.- Specified by:
getProxyConfigurationin interfaceAsyncProxyManager<K>- Parameters:
key- the unique identifier used to point to the bucket in external storage.- Returns:
- The future that completed by optional surround the configuration or empty optional if bucket with specified key is not stored.
-
withMapper
public <K2> AsyncProxyManager<K2> withMapper(Function<? super K2,? extends K> innerMapper)
Description copied from interface:AsyncProxyManagerReturns a proxy object that wraps this AsyncProxyManager such that keys are first mapped using the specified mapping function before being sent to the remote store. The returned AsyncProxyManager shares the same underlying store as the original, and keys that map to the same value will share the same remote state.- Specified by:
withMapperin interfaceAsyncProxyManager<K>- Type Parameters:
K2- the type of key accepted by returned AsyncProxyManager- Parameters:
innerMapper- the mapper function to apply to keys- Returns:
- a proxy object that wraps this AsyncProxyManager
-
-