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 TableFunction
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 . |
default java.util.concurrent.CompletableFuture<java.util.Map<K,V>> |
getAllAsync(java.util.Collection<K> keys,
java.lang.Object... args)
Asynchronously fetch the table
records for specified keys and additional arguments. |
java.util.concurrent.CompletableFuture<V> |
getAsync(K key)
Asynchronously fetch single table record for a specified
key . |
default java.util.concurrent.CompletableFuture<V> |
getAsync(K key,
java.lang.Object... args)
Asynchronously fetch single table record for a specified
key with additional arguments. |
default <T> java.util.concurrent.CompletableFuture<T> |
readAsync(int opId,
java.lang.Object... args)
Asynchronously read data from table for specified
opId and additional arguments. |
init, isRetriable
close
default 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 recordkey
java.util.concurrent.CompletableFuture<V> getAsync(K key)
key
. This method must be thread-safe.key
- key for the table recorddefault java.util.concurrent.CompletableFuture<V> getAsync(K key, java.lang.Object... args)
key
with additional arguments.
This method must be thread-safe.key
- key for the table recordargs
- additional argumentsdefault 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 recordsdefault java.util.concurrent.CompletableFuture<java.util.Map<K,V>> getAllAsync(java.util.Collection<K> keys, java.lang.Object... args)
records
for specified keys
and additional arguments.
This method must be thread-safe.keys
- keys for the table recordsargs
- additional argumentsdefault <T> java.util.concurrent.CompletableFuture<T> readAsync(int opId, java.lang.Object... args)
opId
and additional arguments.
This method must be thread-safe.T
- return typeopId
- operation identifierargs
- additional arguments