V2 - value type of other mapV1 - value type of this mappublic class TranscodingAsyncConsistentTreeMap<V1,V2> extends Object implements AsyncConsistentTreeMap<V1>
AsyncConsistentTreeMap that maps its operations to operations on
a differently typed AsyncConsistentTreeMap by transcoding operation
inputs and outputs.DistributedPrimitive.Status, DistributedPrimitive.TypeDEFAULT_OPERTATION_TIMEOUT_MILLIS| Constructor and Description |
|---|
TranscodingAsyncConsistentTreeMap(AsyncConsistentTreeMap<V2> backingMap,
Function<V1,V2> valueEncoder,
Function<V2,V1> valueDecoder) |
| Modifier and Type | Method and Description |
|---|---|
CompletableFuture<Void> |
addListener(MapEventListener<String,V1> listener,
Executor executor)
Registers the specified listener to be notified whenever the map is updated.
|
CompletableFuture<Version> |
begin(TransactionId transactionId)
Begins the transaction.
|
CompletableFuture<Map.Entry<String,Versioned<V1>>> |
ceilingEntry(String key)
Returns the entry associated with the least key greater than or equal to
the key.
|
CompletableFuture<String> |
ceilingKey(String key)
Return the lowest key greater than or equal to key.
|
CompletableFuture<Void> |
clear()
Removes all of the mappings from this map (optional operation).
|
CompletableFuture<Void> |
commit(TransactionId transactionId)
Commits a previously prepared transaction and unlocks the object.
|
CompletableFuture<Versioned<V1>> |
computeIf(String key,
Predicate<? super V1> condition,
BiFunction<? super String,? super V1,? extends V1> remappingFunction)
If the value for the specified key satisfies a condition, attempts to compute a new
mapping given the key and its current mapped value.
|
CompletableFuture<Boolean> |
containsKey(String key)
Returns true if this map contains a mapping for the specified key.
|
CompletableFuture<Boolean> |
containsValue(V1 value)
Returns true if this map contains the specified value.
|
CompletableFuture<Set<Map.Entry<String,Versioned<V1>>>> |
entrySet()
Returns the set of entries contained in this map.
|
CompletableFuture<Map.Entry<String,Versioned<V1>>> |
firstEntry()
Return the entry associated with the lowest key in the map.
|
CompletableFuture<String> |
firstKey()
Return the lowest key in the map.
|
CompletableFuture<Map.Entry<String,Versioned<V1>>> |
floorEntry(String key)
Returns the entry associated with the greatest key less than or equal
to key.
|
CompletableFuture<String> |
floorKey(String key)
Return the highest key less than or equal to key.
|
CompletableFuture<Versioned<V1>> |
get(String key)
Returns the value (and version) to which the specified key is mapped, or null if this
map contains no mapping for the key.
|
CompletableFuture<Versioned<V1>> |
getOrDefault(String key,
V1 defaultValue)
Returns the value (and version) to which the specified key is mapped, or the provided
default value if this map contains no mapping for the key.
|
CompletableFuture<Map.Entry<String,Versioned<V1>>> |
higherEntry(String key)
Returns the entry associated with the least key greater than key.
|
CompletableFuture<String> |
higherKey(String key)
Return the lowest key greater than key.
|
CompletableFuture<Set<String>> |
keySet()
Returns a Set view of the keys contained in this map.
|
CompletableFuture<Map.Entry<String,Versioned<V1>>> |
lastEntry()
Return the entry associated with the highest key in the map.
|
CompletableFuture<String> |
lastKey()
Return the highest key in the map.
|
CompletableFuture<Map.Entry<String,Versioned<V1>>> |
lowerEntry(String key)
Returns the entry associated with the largest key less than key.
|
CompletableFuture<String> |
lowerKey(String key)
Return the entry associated with the greatest key less than key.
|
String |
name()
Returns the name of this primitive.
|
CompletableFuture<NavigableSet<String>> |
navigableKeySet()
Returns a navigable set of the keys in this map.
|
CompletableFuture<Map.Entry<String,Versioned<V1>>> |
pollFirstEntry()
Return and remove the entry associated with the lowest key.
|
CompletableFuture<Map.Entry<String,Versioned<V1>>> |
pollLastEntry()
Return and remove the entry associated with the highest key.
|
CompletableFuture<Boolean> |
prepare(TransactionLog<MapUpdate<String,V1>> transactionLog)
Prepares a transaction for commitment.
|
CompletableFuture<Boolean> |
prepareAndCommit(TransactionLog<MapUpdate<String,V1>> transactionLog)
Prepares and commits a transaction.
|
CompletableFuture<Versioned<V1>> |
put(String key,
V1 value)
Associates the specified value with the specified key in this map (optional operation).
|
CompletableFuture<Versioned<V1>> |
putAndGet(String key,
V1 value)
Associates the specified value with the specified key in this map (optional operation).
|
CompletableFuture<Versioned<V1>> |
putIfAbsent(String key,
V1 value)
If the specified key is not already associated with a value associates
it with the given value and returns null, else behaves as a get
returning the existing mapping without making any changes.
|
CompletableFuture<Versioned<V1>> |
remove(String key)
Removes the mapping for a key from this map if it is present (optional operation).
|
CompletableFuture<Boolean> |
remove(String key,
long version)
Removes the entry for the specified key only if its current
version in the map is equal to the specified version.
|
CompletableFuture<Boolean> |
remove(String key,
V1 value)
Removes the entry for the specified key only if it is currently
mapped to the specified value.
|
CompletableFuture<Void> |
removeListener(MapEventListener<String,V1> listener)
Unregisters the specified listener such that it will no longer
receive map change notifications.
|
CompletableFuture<Boolean> |
replace(String key,
long oldVersion,
V1 newValue)
Replaces the entry for the specified key only if it is currently mapped to the
specified version.
|
CompletableFuture<Versioned<V1>> |
replace(String key,
V1 value)
Replaces the entry for the specified key only if there is any value
which associated with specified key.
|
CompletableFuture<Boolean> |
replace(String key,
V1 oldValue,
V1 newValue)
Replaces the entry for the specified key only if currently mapped
to the specified value.
|
CompletableFuture<Void> |
rollback(TransactionId transactionId)
Aborts a previously prepared transaction and unlocks the object.
|
CompletableFuture<Integer> |
size()
Returns the number of entries in the map.
|
CompletableFuture<NavigableMap<String,V1>> |
subMap(String upperKey,
String lowerKey,
boolean inclusiveUpper,
boolean inclusiveLower)
Returns a navigable map containing the entries from the original map
which are larger than (or if specified equal to)
lowerKey AND
less than (or if specified equal to) upperKey. |
CompletableFuture<Collection<Versioned<V1>>> |
values()
Returns the collection of values (and associated versions) contained in this map.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitasTreeMap, asTreeMapaddListener, asConsistentMap, asConsistentMap, compute, computeIfAbsent, computeIfPresent, destroy, isEmpty, primitiveTypeaddStatusChangeListener, applicationId, removeStatusChangeListener, statusChangeListenerspublic CompletableFuture<String> firstKey()
AsyncConsistentTreeMapfirstKey in interface AsyncConsistentTreeMap<V1>public CompletableFuture<String> lastKey()
AsyncConsistentTreeMaplastKey in interface AsyncConsistentTreeMap<V1>public CompletableFuture<Map.Entry<String,Versioned<V1>>> ceilingEntry(String key)
AsyncConsistentTreeMapceilingEntry in interface AsyncConsistentTreeMap<V1>key - the keypublic CompletableFuture<Map.Entry<String,Versioned<V1>>> floorEntry(String key)
AsyncConsistentTreeMapfloorEntry in interface AsyncConsistentTreeMap<V1>key - the keypublic CompletableFuture<Map.Entry<String,Versioned<V1>>> higherEntry(String key)
AsyncConsistentTreeMaphigherEntry in interface AsyncConsistentTreeMap<V1>key - the keypublic CompletableFuture<Map.Entry<String,Versioned<V1>>> lowerEntry(String key)
AsyncConsistentTreeMaplowerEntry in interface AsyncConsistentTreeMap<V1>key - the keypublic CompletableFuture<Map.Entry<String,Versioned<V1>>> firstEntry()
AsyncConsistentTreeMapfirstEntry in interface AsyncConsistentTreeMap<V1>public CompletableFuture<Map.Entry<String,Versioned<V1>>> lastEntry()
AsyncConsistentTreeMaplastEntry in interface AsyncConsistentTreeMap<V1>public CompletableFuture<Map.Entry<String,Versioned<V1>>> pollFirstEntry()
AsyncConsistentTreeMappollFirstEntry in interface AsyncConsistentTreeMap<V1>public CompletableFuture<Map.Entry<String,Versioned<V1>>> pollLastEntry()
AsyncConsistentTreeMappollLastEntry in interface AsyncConsistentTreeMap<V1>public CompletableFuture<String> lowerKey(String key)
AsyncConsistentTreeMaplowerKey in interface AsyncConsistentTreeMap<V1>key - the keypublic CompletableFuture<String> floorKey(String key)
AsyncConsistentTreeMapfloorKey in interface AsyncConsistentTreeMap<V1>key - the keypublic CompletableFuture<String> ceilingKey(String key)
AsyncConsistentTreeMapceilingKey in interface AsyncConsistentTreeMap<V1>key - the keypublic CompletableFuture<String> higherKey(String key)
AsyncConsistentTreeMaphigherKey in interface AsyncConsistentTreeMap<V1>key - the keypublic CompletableFuture<NavigableSet<String>> navigableKeySet()
AsyncConsistentTreeMapnavigableKeySet in interface AsyncConsistentTreeMap<V1>public CompletableFuture<NavigableMap<String,V1>> subMap(String upperKey, String lowerKey, boolean inclusiveUpper, boolean inclusiveLower)
AsyncConsistentTreeMaplowerKey AND
less than (or if specified equal to) upperKey.subMap in interface AsyncConsistentTreeMap<V1>upperKey - the upper bound for the keys in this maplowerKey - the lower bound for the keys in this mapinclusiveUpper - whether keys equal to the upperKey should be
includedinclusiveLower - whether keys equal to the lowerKey should be
includedpublic String name()
DistributedPrimitivename in interface DistributedPrimitivepublic CompletableFuture<Integer> size()
AsyncConsistentMapsize in interface AsyncConsistentMap<String,V1>public CompletableFuture<Boolean> containsKey(String key)
AsyncConsistentMapcontainsKey in interface AsyncConsistentMap<String,V1>key - keypublic CompletableFuture<Boolean> containsValue(V1 value)
AsyncConsistentMapcontainsValue in interface AsyncConsistentMap<String,V1>value - valuepublic CompletableFuture<Versioned<V1>> get(String key)
AsyncConsistentMapget in interface AsyncConsistentMap<String,V1>key - the key whose associated value (and version) is to be returnedpublic CompletableFuture<Versioned<V1>> getOrDefault(String key, V1 defaultValue)
AsyncConsistentMapgetOrDefault in interface AsyncConsistentMap<String,V1>key - the key whose associated value (and version) is to be returneddefaultValue - the default value to return if the key is not setpublic CompletableFuture<Versioned<V1>> computeIf(String key, Predicate<? super V1> condition, BiFunction<? super String,? super V1,? extends V1> remappingFunction)
AsyncConsistentMapcomputeIf in interface AsyncConsistentMap<String,V1>key - key with which the specified value is to be associatedcondition - condition that should evaluate to true for the computation to proceedremappingFunction - the function to compute a valuepublic CompletableFuture<Versioned<V1>> put(String key, V1 value)
AsyncConsistentMapput in interface AsyncConsistentMap<String,V1>key - key with which the specified value is to be associatedvalue - value to be associated with the specified keypublic CompletableFuture<Versioned<V1>> putAndGet(String key, V1 value)
AsyncConsistentMapputAndGet in interface AsyncConsistentMap<String,V1>key - key with which the specified value is to be associatedvalue - value to be associated with the specified keypublic CompletableFuture<Versioned<V1>> remove(String key)
AsyncConsistentMapremove in interface AsyncConsistentMap<String,V1>key - key whose value is to be removed from the mappublic CompletableFuture<Void> clear()
AsyncConsistentMapclear in interface AsyncConsistentMap<String,V1>public CompletableFuture<Set<String>> keySet()
AsyncConsistentMapkeySet in interface AsyncConsistentMap<String,V1>public CompletableFuture<Collection<Versioned<V1>>> values()
AsyncConsistentMapvalues in interface AsyncConsistentMap<String,V1>public CompletableFuture<Set<Map.Entry<String,Versioned<V1>>>> entrySet()
AsyncConsistentMapentrySet in interface AsyncConsistentMap<String,V1>public CompletableFuture<Versioned<V1>> putIfAbsent(String key, V1 value)
AsyncConsistentMapputIfAbsent in interface AsyncConsistentMap<String,V1>key - key with which the specified value is to be associatedvalue - value to be associated with the specified keypublic CompletableFuture<Boolean> remove(String key, V1 value)
AsyncConsistentMapremove in interface AsyncConsistentMap<String,V1>key - key with which the specified value is associatedvalue - value expected to be associated with the specified keypublic CompletableFuture<Boolean> remove(String key, long version)
AsyncConsistentMapremove in interface AsyncConsistentMap<String,V1>key - key with which the specified version is associatedversion - version expected to be associated with the specified keypublic CompletableFuture<Versioned<V1>> replace(String key, V1 value)
AsyncConsistentMapreplace in interface AsyncConsistentMap<String,V1>key - key with which the specified value is associatedvalue - value expected to be associated with the specified keypublic CompletableFuture<Boolean> replace(String key, V1 oldValue, V1 newValue)
AsyncConsistentMapreplace in interface AsyncConsistentMap<String,V1>key - key with which the specified value is associatedoldValue - value expected to be associated with the specified keynewValue - value to be associated with the specified keypublic CompletableFuture<Boolean> replace(String key, long oldVersion, V1 newValue)
AsyncConsistentMapreplace in interface AsyncConsistentMap<String,V1>key - key key with which the specified value is associatedoldVersion - version expected to be associated with the specified keynewValue - value to be associated with the specified keypublic CompletableFuture<Void> addListener(MapEventListener<String,V1> listener, Executor executor)
AsyncConsistentMapaddListener in interface AsyncConsistentMap<String,V1>listener - listener to notify about map eventsexecutor - executor to use for handling incoming map eventspublic CompletableFuture<Void> removeListener(MapEventListener<String,V1> listener)
AsyncConsistentMapremoveListener in interface AsyncConsistentMap<String,V1>listener - listener to unregisterpublic CompletableFuture<Version> begin(TransactionId transactionId)
Transactionalbegin in interface Transactional<MapUpdate<String,V1>>transactionId - the transaction identifier for the transaction to beginpublic CompletableFuture<Boolean> prepare(TransactionLog<MapUpdate<String,V1>> transactionLog)
Transactionalprepare in interface Transactional<MapUpdate<String,V1>>transactionLog - transaction logtrue if prepare is successful and transaction is ready to be committed
false otherwisepublic CompletableFuture<Boolean> prepareAndCommit(TransactionLog<MapUpdate<String,V1>> transactionLog)
TransactionalprepareAndCommit in interface Transactional<MapUpdate<String,V1>>transactionLog - transaction logtrue if prepare is successful and transaction was committed
false otherwisepublic CompletableFuture<Void> commit(TransactionId transactionId)
Transactionalcommit in interface Transactional<MapUpdate<String,V1>>transactionId - transaction identifierpublic CompletableFuture<Void> rollback(TransactionId transactionId)
Transactionalrollback in interface Transactional<MapUpdate<String,V1>>transactionId - transaction identifier