public class AtomixConsistentTreeMap extends io.atomix.resource.AbstractResource<AtomixConsistentTreeMap> implements AsyncConsistentTreeMap<byte[]>
AsyncConsistentTreeMap.DistributedPrimitive.Status, DistributedPrimitive.Type| Modifier and Type | Field and Description |
|---|---|
static String |
CHANGE_SUBJECT |
DEFAULT_OPERTATION_TIMEOUT_MILLIS| Constructor and Description |
|---|
AtomixConsistentTreeMap(io.atomix.copycat.client.CopycatClient client,
Properties options) |
| Modifier and Type | Method and Description |
|---|---|
CompletableFuture<Void> |
addListener(MapEventListener<String,byte[]> 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<byte[]>>> |
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<byte[]>> |
computeIf(String key,
Predicate<? super byte[]> condition,
BiFunction<? super String,? super byte[],? extends byte[]> 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(byte[] value)
Returns true if this map contains the specified value.
|
CompletableFuture<Set<Map.Entry<String,Versioned<byte[]>>>> |
entrySet()
Returns the set of entries contained in this map.
|
CompletableFuture<Map.Entry<String,Versioned<byte[]>>> |
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<byte[]>>> |
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<byte[]>> |
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<byte[]>> |
getOrDefault(String key,
byte[] 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<byte[]>>> |
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<Boolean> |
isEmpty()
Returns true if the map is empty.
|
CompletableFuture<Set<String>> |
keySet()
Returns a Set view of the keys contained in this map.
|
CompletableFuture<Map.Entry<String,Versioned<byte[]>>> |
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<byte[]>>> |
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<AtomixConsistentTreeMap> |
open() |
CompletableFuture<Map.Entry<String,Versioned<byte[]>>> |
pollFirstEntry()
Return and remove the entry associated with the lowest key.
|
CompletableFuture<Map.Entry<String,Versioned<byte[]>>> |
pollLastEntry()
Return and remove the entry associated with the highest key.
|
CompletableFuture<Boolean> |
prepare(TransactionLog<MapUpdate<String,byte[]>> transactionLog)
Prepares a transaction for commitment.
|
CompletableFuture<Boolean> |
prepareAndCommit(TransactionLog<MapUpdate<String,byte[]>> transactionLog)
Prepares and commits a transaction.
|
CompletableFuture<Versioned<byte[]>> |
put(String key,
byte[] value)
Associates the specified value with the specified key in this map (optional operation).
|
CompletableFuture<Versioned<byte[]>> |
putAndGet(String key,
byte[] value)
Associates the specified value with the specified key in this map (optional operation).
|
CompletableFuture<Versioned<byte[]>> |
putIfAbsent(String key,
byte[] 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<byte[]>> |
remove(String key)
Removes the mapping for a key from this map if it is present (optional operation).
|
CompletableFuture<Boolean> |
remove(String key,
byte[] value)
Removes the entry for the specified key only if it is currently
mapped to the specified value.
|
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<Void> |
removeListener(MapEventListener<String,byte[]> listener)
Unregisters the specified listener such that it will no longer
receive map change notifications.
|
CompletableFuture<Versioned<byte[]>> |
replace(String key,
byte[] value)
Replaces the entry for the specified key only if there is any value
which associated with specified key.
|
CompletableFuture<Boolean> |
replace(String key,
byte[] oldValue,
byte[] newValue)
Replaces the entry for the specified key only if currently mapped
to the specified value.
|
CompletableFuture<Boolean> |
replace(String key,
long oldVersion,
byte[] newValue)
Replaces the entry for the specified key only if it is currently mapped to the
specified version.
|
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,byte[]>> |
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<byte[]>>> |
values()
Returns the collection of values (and associated versions) contained in this map.
|
close, config, context, delete, equals, hashCode, isClosed, isOpen, onEvent, onRecovery, onStateChange, options, recover, serializer, state, toString, typeclone, finalize, getClass, notify, notifyAll, wait, wait, waitasTreeMap, asTreeMapaddListener, asConsistentMap, asConsistentMap, compute, computeIfAbsent, computeIfPresent, destroy, primitiveTypeaddStatusChangeListener, applicationId, removeStatusChangeListener, statusChangeListenerspublic static final String CHANGE_SUBJECT
public AtomixConsistentTreeMap(io.atomix.copycat.client.CopycatClient client,
Properties options)
public String name()
DistributedPrimitivename in interface DistributedPrimitivepublic CompletableFuture<AtomixConsistentTreeMap> open()
open in interface io.atomix.catalyst.util.Managed<AtomixConsistentTreeMap>open in interface io.atomix.resource.Resource<AtomixConsistentTreeMap>open in class io.atomix.resource.AbstractResource<AtomixConsistentTreeMap>public CompletableFuture<Boolean> isEmpty()
AsyncConsistentMapisEmpty in interface AsyncConsistentMap<String,byte[]>public CompletableFuture<Integer> size()
AsyncConsistentMapsize in interface AsyncConsistentMap<String,byte[]>public CompletableFuture<Boolean> containsKey(String key)
AsyncConsistentMapcontainsKey in interface AsyncConsistentMap<String,byte[]>key - keypublic CompletableFuture<Boolean> containsValue(byte[] value)
AsyncConsistentMapcontainsValue in interface AsyncConsistentMap<String,byte[]>value - valuepublic CompletableFuture<Versioned<byte[]>> get(String key)
AsyncConsistentMapget in interface AsyncConsistentMap<String,byte[]>key - the key whose associated value (and version) is to be returnedpublic CompletableFuture<Versioned<byte[]>> getOrDefault(String key, byte[] defaultValue)
AsyncConsistentMapgetOrDefault in interface AsyncConsistentMap<String,byte[]>key - the key whose associated value (and version) is to be returneddefaultValue - the default value to return if the key is not setpublic CompletableFuture<Set<String>> keySet()
AsyncConsistentMapkeySet in interface AsyncConsistentMap<String,byte[]>public CompletableFuture<Collection<Versioned<byte[]>>> values()
AsyncConsistentMapvalues in interface AsyncConsistentMap<String,byte[]>public CompletableFuture<Set<Map.Entry<String,Versioned<byte[]>>>> entrySet()
AsyncConsistentMapentrySet in interface AsyncConsistentMap<String,byte[]>public CompletableFuture<Versioned<byte[]>> put(String key, byte[] value)
AsyncConsistentMapput in interface AsyncConsistentMap<String,byte[]>key - key with which the specified value is to be associatedvalue - value to be associated with the specified keypublic CompletableFuture<Versioned<byte[]>> putAndGet(String key, byte[] value)
AsyncConsistentMapputAndGet in interface AsyncConsistentMap<String,byte[]>key - key with which the specified value is to be associatedvalue - value to be associated with the specified keypublic CompletableFuture<Versioned<byte[]>> putIfAbsent(String key, byte[] value)
AsyncConsistentMapputIfAbsent in interface AsyncConsistentMap<String,byte[]>key - key with which the specified value is to be associatedvalue - value to be associated with the specified keypublic CompletableFuture<Versioned<byte[]>> remove(String key)
AsyncConsistentMapremove in interface AsyncConsistentMap<String,byte[]>key - key whose value is to be removed from the mappublic CompletableFuture<Boolean> remove(String key, byte[] value)
AsyncConsistentMapremove in interface AsyncConsistentMap<String,byte[]>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,byte[]>key - key with which the specified version is associatedversion - version expected to be associated with the specified keypublic CompletableFuture<Versioned<byte[]>> replace(String key, byte[] value)
AsyncConsistentMapreplace in interface AsyncConsistentMap<String,byte[]>key - key with which the specified value is associatedvalue - value expected to be associated with the specified keypublic CompletableFuture<Boolean> replace(String key, byte[] oldValue, byte[] newValue)
AsyncConsistentMapreplace in interface AsyncConsistentMap<String,byte[]>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, byte[] newValue)
AsyncConsistentMapreplace in interface AsyncConsistentMap<String,byte[]>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> clear()
AsyncConsistentMapclear in interface AsyncConsistentMap<String,byte[]>public CompletableFuture<Versioned<byte[]>> computeIf(String key, Predicate<? super byte[]> condition, BiFunction<? super String,? super byte[],? extends byte[]> remappingFunction)
AsyncConsistentMapcomputeIf in interface AsyncConsistentMap<String,byte[]>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<Void> addListener(MapEventListener<String,byte[]> listener, Executor executor)
AsyncConsistentMapaddListener in interface AsyncConsistentMap<String,byte[]>listener - listener to notify about map eventsexecutor - executor to use for handling incoming map eventspublic CompletableFuture<Void> removeListener(MapEventListener<String,byte[]> listener)
AsyncConsistentMapremoveListener in interface AsyncConsistentMap<String,byte[]>listener - listener to unregisterpublic CompletableFuture<String> firstKey()
AsyncConsistentTreeMapfirstKey in interface AsyncConsistentTreeMap<byte[]>public CompletableFuture<String> lastKey()
AsyncConsistentTreeMaplastKey in interface AsyncConsistentTreeMap<byte[]>public CompletableFuture<Map.Entry<String,Versioned<byte[]>>> ceilingEntry(String key)
AsyncConsistentTreeMapceilingEntry in interface AsyncConsistentTreeMap<byte[]>key - the keypublic CompletableFuture<Map.Entry<String,Versioned<byte[]>>> floorEntry(String key)
AsyncConsistentTreeMapfloorEntry in interface AsyncConsistentTreeMap<byte[]>key - the keypublic CompletableFuture<Map.Entry<String,Versioned<byte[]>>> higherEntry(String key)
AsyncConsistentTreeMaphigherEntry in interface AsyncConsistentTreeMap<byte[]>key - the keypublic CompletableFuture<Map.Entry<String,Versioned<byte[]>>> lowerEntry(String key)
AsyncConsistentTreeMaplowerEntry in interface AsyncConsistentTreeMap<byte[]>key - the keypublic CompletableFuture<Map.Entry<String,Versioned<byte[]>>> firstEntry()
AsyncConsistentTreeMapfirstEntry in interface AsyncConsistentTreeMap<byte[]>public CompletableFuture<Map.Entry<String,Versioned<byte[]>>> lastEntry()
AsyncConsistentTreeMaplastEntry in interface AsyncConsistentTreeMap<byte[]>public CompletableFuture<Map.Entry<String,Versioned<byte[]>>> pollFirstEntry()
AsyncConsistentTreeMappollFirstEntry in interface AsyncConsistentTreeMap<byte[]>public CompletableFuture<Map.Entry<String,Versioned<byte[]>>> pollLastEntry()
AsyncConsistentTreeMappollLastEntry in interface AsyncConsistentTreeMap<byte[]>public CompletableFuture<String> lowerKey(String key)
AsyncConsistentTreeMaplowerKey in interface AsyncConsistentTreeMap<byte[]>key - the keypublic CompletableFuture<String> floorKey(String key)
AsyncConsistentTreeMapfloorKey in interface AsyncConsistentTreeMap<byte[]>key - the keypublic CompletableFuture<String> ceilingKey(String key)
AsyncConsistentTreeMapceilingKey in interface AsyncConsistentTreeMap<byte[]>key - the keypublic CompletableFuture<String> higherKey(String key)
AsyncConsistentTreeMaphigherKey in interface AsyncConsistentTreeMap<byte[]>key - the keypublic CompletableFuture<NavigableSet<String>> navigableKeySet()
AsyncConsistentTreeMapnavigableKeySet in interface AsyncConsistentTreeMap<byte[]>public CompletableFuture<NavigableMap<String,byte[]>> subMap(String upperKey, String lowerKey, boolean inclusiveUpper, boolean inclusiveLower)
AsyncConsistentTreeMaplowerKey AND
less than (or if specified equal to) upperKey.subMap in interface AsyncConsistentTreeMap<byte[]>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 CompletableFuture<Version> begin(TransactionId transactionId)
Transactionalbegin in interface Transactional<MapUpdate<String,byte[]>>transactionId - the transaction identifier for the transaction to beginpublic CompletableFuture<Boolean> prepare(TransactionLog<MapUpdate<String,byte[]>> transactionLog)
Transactionalprepare in interface Transactional<MapUpdate<String,byte[]>>transactionLog - transaction logtrue if prepare is successful and transaction is ready to be committed
false otherwisepublic CompletableFuture<Boolean> prepareAndCommit(TransactionLog<MapUpdate<String,byte[]>> transactionLog)
TransactionalprepareAndCommit in interface Transactional<MapUpdate<String,byte[]>>transactionLog - transaction logtrue if prepare is successful and transaction was committed
false otherwisepublic CompletableFuture<Void> commit(TransactionId transactionId)
Transactionalcommit in interface Transactional<MapUpdate<String,byte[]>>transactionId - transaction identifierpublic CompletableFuture<Void> rollback(TransactionId transactionId)
Transactionalrollback in interface Transactional<MapUpdate<String,byte[]>>transactionId - transaction identifier