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 TableFunction
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. |
default java.util.concurrent.CompletableFuture<java.lang.Void> |
deleteAllAsync(java.util.Collection<K> keys,
java.lang.Object... args)
Asynchronously delete all
records with the specified keys and additional arguments 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 java.util.concurrent.CompletableFuture<java.lang.Void> |
deleteAsync(K key,
java.lang.Object... args)
Asynchronously delete the
record with specified key and additional arguments from the remote store |
default void |
flush()
Flush the remote store (optional)
|
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 . |
default java.util.concurrent.CompletableFuture<java.lang.Void> |
putAllAsync(java.util.Collection<Entry<K,V>> records,
java.lang.Object... args)
Asynchronously store the table
records with specified keys and additional arguments. |
java.util.concurrent.CompletableFuture<java.lang.Void> |
putAsync(K key,
V record)
Asynchronously store single table
record with specified key . |
default java.util.concurrent.CompletableFuture<java.lang.Void> |
putAsync(K key,
V record,
java.lang.Object... args)
Asynchronously store single table
record with specified key and additional arguments. |
default <T> java.util.concurrent.CompletableFuture<T> |
writeAsync(int opId,
java.lang.Object... args)
Asynchronously write data to table for specified
opId and additional arguments. |
init, isRetriable
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 java.util.concurrent.CompletableFuture<java.lang.Void> putAsync(K key, V record, java.lang.Object... args)
record
with specified key
and additional arguments.
This method must be thread-safe.key
- key for the table recordrecord
- table record to be writtenargs
- additional argumentsdefault 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 java.util.concurrent.CompletableFuture<java.lang.Void> putAllAsync(java.util.Collection<Entry<K,V>> records, java.lang.Object... args)
records
with specified keys
and additional arguments.
This method must be thread-safe.records
- table records to be writtenargs
- additional argumentsdefault 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 java.util.concurrent.CompletableFuture<java.lang.Void> deleteAsync(K key, java.lang.Object... args)
record
with specified key
and additional arguments from the remote storekey
- key to the table record to be deletedargs
- additional argumentsdefault 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 writtendefault java.util.concurrent.CompletableFuture<java.lang.Void> deleteAllAsync(java.util.Collection<K> keys, java.lang.Object... args)
records
with the specified keys
and additional arguments from
the remote store.keys
- keys for the table records to be writtenargs
- additional argumentsdefault <T> java.util.concurrent.CompletableFuture<T> writeAsync(int opId, java.lang.Object... args)
opId
and additional arguments.
This method must be thread-safe.T
- return typeopId
- operation identifierargs
- additional argumentsdefault void flush()