Package org.onosproject.store.service
Interface AsyncAtomicCounterMap<K>
- 
- All Superinterfaces:
 DistributedPrimitive
public interface AsyncAtomicCounterMap<K> extends DistributedPrimitive
An async atomic counter map dispenses monotonically increasing values associated with key. 
- 
- 
Nested Class Summary
- 
Nested classes/interfaces inherited from interface org.onosproject.store.service.DistributedPrimitive
DistributedPrimitive.Status, DistributedPrimitive.Type 
 - 
 
- 
Field Summary
- 
Fields inherited from interface org.onosproject.store.service.DistributedPrimitive
DEFAULT_OPERATION_TIMEOUT_MILLIS 
 - 
 
- 
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.util.concurrent.CompletableFuture<java.lang.Long>addAndGet(K key, long delta)Adds delta to the value currently associated with key, and returns the new value.default AtomicCounterMap<K>asAtomicCounterMap()Returns a newAtomicCounterMapthat is backed by this instance.default AtomicCounterMap<K>asAtomicCounterMap(long timeoutMillis)Returns a newAtomicCounterMapthat is backed by this instance.java.util.concurrent.CompletableFuture<java.lang.Void>clear()Removes all entries from the map.java.util.concurrent.CompletableFuture<java.lang.Long>decrementAndGet(K key)Decrements by one the value currently associated with key, and returns the new value.java.util.concurrent.CompletableFuture<java.lang.Long>get(K key)Returns the value associated with key, or zero if there is no value associated with key.java.util.concurrent.CompletableFuture<java.lang.Long>getAndAdd(K key, long delta)Adds delta to the value currently associated with key, and returns the old value.java.util.concurrent.CompletableFuture<java.lang.Long>getAndDecrement(K key)Decrements by one the value currently associated with key, and returns the old value.java.util.concurrent.CompletableFuture<java.lang.Long>getAndIncrement(K key)Increments by one the value currently associated with key, and returns the old value.java.util.concurrent.CompletableFuture<java.lang.Long>incrementAndGet(K key)Increments by one the value currently associated with key, and returns the new value.java.util.concurrent.CompletableFuture<java.lang.Boolean>isEmpty()Returns a boolean indicating whether the map is empty.default DistributedPrimitive.TypeprimitiveType()Returns the type of primitive.java.util.concurrent.CompletableFuture<java.lang.Long>put(K key, long newValue)Associates ewValue with key in this map, and returns the value previously associated with key, or zero if there was no such value.java.util.concurrent.CompletableFuture<java.lang.Long>putIfAbsent(K key, long newValue)If key is not already associated with a value or if key is associated with zero, associate it with newValue.java.util.concurrent.CompletableFuture<java.lang.Long>remove(K key)Removes and returns the value associated with key.java.util.concurrent.CompletableFuture<java.lang.Boolean>remove(K key, long value)If (key, value) is currently in the map, this method removes it and returns true; otherwise, this method returns false.java.util.concurrent.CompletableFuture<java.lang.Boolean>replace(K key, long expectedOldValue, long newValue)If (key, expectedOldValue) is currently in the map, this method replaces expectedOldValue with newValue and returns true; otherwise, this method return false.java.util.concurrent.CompletableFuture<java.lang.Integer>size()Returns the number of entries in the map.- 
Methods inherited from interface org.onosproject.store.service.DistributedPrimitive
addStatusChangeListener, applicationId, destroy, name, removeStatusChangeListener, statusChangeListeners 
 - 
 
 - 
 
- 
- 
Method Detail
- 
primitiveType
default DistributedPrimitive.Type primitiveType()
Description copied from interface:DistributedPrimitiveReturns the type of primitive.- Specified by:
 primitiveTypein interfaceDistributedPrimitive- Returns:
 - primitive type
 
 
- 
incrementAndGet
java.util.concurrent.CompletableFuture<java.lang.Long> incrementAndGet(K key)
Increments by one the value currently associated with key, and returns the new value.- Parameters:
 key- key with which the specified value is to be associated- Returns:
 - incremented value
 
 
- 
decrementAndGet
java.util.concurrent.CompletableFuture<java.lang.Long> decrementAndGet(K key)
Decrements by one the value currently associated with key, and returns the new value.- Parameters:
 key- key with which the specified value is to be associated- Returns:
 - updated value
 
 
- 
getAndIncrement
java.util.concurrent.CompletableFuture<java.lang.Long> getAndIncrement(K key)
Increments by one the value currently associated with key, and returns the old value.- Parameters:
 key- key with which the specified value is to be associated- Returns:
 - previous value
 
 
- 
getAndDecrement
java.util.concurrent.CompletableFuture<java.lang.Long> getAndDecrement(K key)
Decrements by one the value currently associated with key, and returns the old value.- Parameters:
 key- key with which the specified value is to be associated- Returns:
 - previous value
 
 
- 
addAndGet
java.util.concurrent.CompletableFuture<java.lang.Long> addAndGet(K key, long delta)
Adds delta to the value currently associated with key, and returns the new value.- Parameters:
 key- key with which the specified value is to be associateddelta- the value to add- Returns:
 - updated value
 
 
- 
getAndAdd
java.util.concurrent.CompletableFuture<java.lang.Long> getAndAdd(K key, long delta)
Adds delta to the value currently associated with key, and returns the old value.- Parameters:
 key- key with which the specified value is to be associateddelta- the value to add- Returns:
 - previous value
 
 
- 
get
java.util.concurrent.CompletableFuture<java.lang.Long> get(K key)
Returns the value associated with key, or zero if there is no value associated with key.- Parameters:
 key- key with which the specified value is to be associated- Returns:
 - current value
 
 
- 
put
java.util.concurrent.CompletableFuture<java.lang.Long> put(K key, long newValue)
Associates ewValue with key in this map, and returns the value previously associated with key, or zero if there was no such value.- Parameters:
 key- key with which the specified value is to be associatednewValue- the value to put- Returns:
 - previous value or zero
 
 
- 
putIfAbsent
java.util.concurrent.CompletableFuture<java.lang.Long> putIfAbsent(K key, long newValue)
If key is not already associated with a value or if key is associated with zero, associate it with newValue. Returns the previous value associated with key, or zero if there was no mapping for key.- Parameters:
 key- key with which the specified value is to be associatednewValue- the value to put- Returns:
 - previous value or zero
 
 
- 
replace
java.util.concurrent.CompletableFuture<java.lang.Boolean> replace(K key, long expectedOldValue, long newValue)
If (key, expectedOldValue) is currently in the map, this method replaces expectedOldValue with newValue and returns true; otherwise, this method return false. If expectedOldValue is zero, this method will succeed if (key, zero) is currently in the map, or if key is not in the map at all.- Parameters:
 key- key with which the specified value is to be associatedexpectedOldValue- the expected valuenewValue- the value to replace- Returns:
 - true if the value was replaced, false otherwise
 
 
- 
remove
java.util.concurrent.CompletableFuture<java.lang.Long> remove(K key)
Removes and returns the value associated with key. If key is not in the map, this method has no effect and returns zero.- Parameters:
 key- key with which the specified value is to be associated- Returns:
 - the previous value associated with the specified key or null
 
 
- 
remove
java.util.concurrent.CompletableFuture<java.lang.Boolean> remove(K key, long value)
If (key, value) is currently in the map, this method removes it and returns true; otherwise, this method returns false.- Parameters:
 key- key with which the specified value is to be associatedvalue- the value to remove- Returns:
 - true if the value was removed, false otherwise
 
 
- 
size
java.util.concurrent.CompletableFuture<java.lang.Integer> size()
Returns the number of entries in the map.- Returns:
 - the number of entries in the map
 
 
- 
isEmpty
java.util.concurrent.CompletableFuture<java.lang.Boolean> isEmpty()
Returns a boolean indicating whether the map is empty.- Returns:
 - true if the map is empty, false otherwise
 
 
- 
clear
java.util.concurrent.CompletableFuture<java.lang.Void> clear()
Removes all entries from the map.- Returns:
 - void
 
 
- 
asAtomicCounterMap
default AtomicCounterMap<K> asAtomicCounterMap()
Returns a newAtomicCounterMapthat is backed by this instance.- Returns:
 - new 
AtomicCounterMapinstance 
 
- 
asAtomicCounterMap
default AtomicCounterMap<K> asAtomicCounterMap(long timeoutMillis)
Returns a newAtomicCounterMapthat is backed by this instance.- Parameters:
 timeoutMillis- timeout duration for the returned ConsistentMap operations- Returns:
 - new 
AtomicCounterMapinstance 
 
 - 
 
 -