Package io.pravega.common.util
Interface AsyncMap<K,V>
-
- Type Parameters:
K- Type of the Keys.V- Type of the Values.
public interface AsyncMap<K,V>Defines a basic asynchronous Key-Value map which allows adding, getting and removing items. The purpose of this is to abstract a non-memory backed store that may take a while to perform operations (for example, if disk or a network resource is used as a store, significant latency may be part of every operation).This contract definition does not make any guarantees as to the contents' consistency or concurrent access behavior. Please refer to the actual implementation's documentation for such behavior.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.concurrent.CompletableFuture<V>get(K key, java.time.Duration timeout)Retrieves a value from the Map.java.util.concurrent.CompletableFuture<java.lang.Void>put(K key, V value, java.time.Duration timeout)Inserts a new Key-Value pair into the map.java.util.concurrent.CompletableFuture<java.lang.Void>remove(K key, java.time.Duration timeout)Deletes a Key-Value pair from the Map, if any.
-
-
-
Method Detail
-
put
java.util.concurrent.CompletableFuture<java.lang.Void> put(K key, V value, java.time.Duration timeout)
Inserts a new Key-Value pair into the map.- Parameters:
key- The Key to insert/update.value- The Value to insert/update.timeout- Timeout for the operation.- Returns:
- A CompletableFuture that, when completed, indicates that the Key-Value pair has been successfully inserted. If the operation fails, this will complete with the appropriate exception.
-
get
java.util.concurrent.CompletableFuture<V> get(K key, java.time.Duration timeout)
Retrieves a value from the Map.- Parameters:
key- The key to retrieve the value for.timeout- Timeout for the operation.- Returns:
- A CompletableFuture that, when completed, will contain the requested value. If the operation fails, this will complete with the appropriate exception.
-
remove
java.util.concurrent.CompletableFuture<java.lang.Void> remove(K key, java.time.Duration timeout)
Deletes a Key-Value pair from the Map, if any.- Parameters:
key- The Key of the pair to remove.timeout- Timeout for the operation.- Returns:
- A CompletableFuture that, when completed, indicates that the Key has been successfully removed. If the operation fails, this will complete with the appropriate exception.
-
-