K - the type of the key in this tableV - the type of the value in this table@InterfaceStability.Unstable public interface TableReadFunction<K,V> extends java.io.Serializable, InitableFunction, ClosableFunction
Instances of TableReadFunction are meant to be serializable. ie. any non-serializable state
(eg: network sockets) should be marked as transient and recreated inside readObject().
Implementations are expected to be thread-safe.
| Modifier and Type | Method and Description |
|---|---|
default V |
get(K key)
Fetch single table record for a specified
key. |
default java.util.Map<K,V> |
getAll(java.util.Collection<K> keys)
Fetch the table
records for specified keys. |
default java.util.concurrent.CompletableFuture<java.util.Map<K,V>> |
getAllAsync(java.util.Collection<K> keys)
Asynchronously fetch the table
records for specified keys. |
java.util.concurrent.CompletableFuture<V> |
getAsync(K key)
Asynchronously fetch single table record for a specified
key. |
boolean |
isRetriable(java.lang.Throwable exception)
Determine whether the current operation can be retried with the last thrown exception.
|
initclosedefault V get(K key)
key. This method must be thread-safe.
The default implementation calls getAsync and blocks on the completion afterwards.key - key for the table recordkeyjava.util.concurrent.CompletableFuture<V> getAsync(K key)
key. This method must be thread-safe.key - key for the table recorddefault java.util.Map<K,V> getAll(java.util.Collection<K> keys)
records for specified keys. This method must be thread-safe.
The default implementation calls getAllAsync and blocks on the completion afterwards.keys - keys for the table recordsdefault java.util.concurrent.CompletableFuture<java.util.Map<K,V>> getAllAsync(java.util.Collection<K> keys)
records for specified keys. This method must be thread-safe.
The default implementation calls getAsync for each key and return a combined future.keys - keys for the table recordsboolean isRetriable(java.lang.Throwable exception)
exception - exception thrown by a table operation