K
- the type of the key in this tableV
- the type of the value in this table@InterfaceStability.Unstable public interface TableWriteFunction<K,V> extends java.io.Serializable, InitableFunction, ClosableFunction
Instances of TableWriteFunction
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 void |
delete(K key)
Delete the
record with specified key from the remote store. |
default void |
deleteAll(java.util.Collection<K> keys)
Delete all
records with the specified keys from the remote store
The default implementation calls deleteAllAsync and blocks on the completion afterwards. |
default java.util.concurrent.CompletableFuture<java.lang.Void> |
deleteAllAsync(java.util.Collection<K> keys)
Asynchronously delete all
records with the specified keys from the remote store. |
java.util.concurrent.CompletableFuture<java.lang.Void> |
deleteAsync(K key)
Asynchronously delete the
record with specified key from the remote store |
default void |
flush()
Flush the remote store (optional)
|
boolean |
isRetriable(java.lang.Throwable exception)
Determine whether the current operation can be retried with the last thrown exception.
|
default void |
put(K key,
V record)
Store single table
record with specified key . |
default void |
putAll(java.util.List<Entry<K,V>> records)
Store the table
records with specified keys . |
default java.util.concurrent.CompletableFuture<java.lang.Void> |
putAllAsync(java.util.Collection<Entry<K,V>> records)
Asynchronously store the table
records with specified keys . |
java.util.concurrent.CompletableFuture<java.lang.Void> |
putAsync(K key,
V record)
Asynchronously store single table
record with specified key . |
init
close
default void put(K key, V record)
record
with specified key
. This method must be thread-safe.
The default implementation calls putAsync and blocks on the completion afterwards.key
- key for the table recordrecord
- table record to be writtenjava.util.concurrent.CompletableFuture<java.lang.Void> putAsync(K key, V record)
record
with specified key
. This method must be thread-safe.key
- key for the table recordrecord
- table record to be writtendefault void putAll(java.util.List<Entry<K,V>> records)
records
with specified keys
. This method must be thread-safe.
The default implementation calls putAllAsync and blocks on the completion afterwards.records
- table records to be writtendefault java.util.concurrent.CompletableFuture<java.lang.Void> putAllAsync(java.util.Collection<Entry<K,V>> records)
records
with specified keys
. This method must be thread-safe.
The default implementation calls putAsync for each entry and return a combined future.records
- table records to be writtendefault void delete(K key)
record
with specified key
from the remote store.
The default implementation calls deleteAsync and blocks on the completion afterwards.key
- key to the table record to be deletedjava.util.concurrent.CompletableFuture<java.lang.Void> deleteAsync(K key)
record
with specified key
from the remote storekey
- key to the table record to be deleteddefault void deleteAll(java.util.Collection<K> keys)
records
with the specified keys
from the remote store
The default implementation calls deleteAllAsync and blocks on the completion afterwards.keys
- keys for the table records to be writtendefault java.util.concurrent.CompletableFuture<java.lang.Void> deleteAllAsync(java.util.Collection<K> keys)
records
with the specified keys
from the remote store.
The default implementation calls deleteAsync for each key and return a combined future.keys
- keys for the table records to be writtenboolean isRetriable(java.lang.Throwable exception)
exception
- exception thrown by a table operationdefault void flush()