Class CacheAdapter<K,V>
java.lang.Object
org.gridgain.ignite.migrationtools.adapter.internal.CacheAdapter<K,V>
- Type Parameters:
K- Key type.V- Value type.
Provides basic methods to interact with an Ignite 3 table in a similar fashion as an Ignite 2.
-
Constructor Summary
ConstructorsConstructorDescriptionCacheAdapter(ClientAdapter clientAdapter, org.apache.ignite3.sql.IgniteSql sql, org.apache.ignite3.internal.client.table.ClientTable clientTable, org.apache.ignite3.table.mapper.Mapper<K> keyMapper, org.apache.ignite3.table.mapper.Mapper<V> valueMapper, Supplier<org.apache.ignite3.tx.Transaction> txSupplier, CacheTableReference cacheRef) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionclear()containsKey(K key) containsKeys(Set<? extends K> keys) destroy()Gets a value associated with a given key.Get values associated with the given keys.getAndPutIfAbsent(K key, V val) getAndRemove(K key) getAndReplace(K key, V val) org.apache.ignite3.internal.client.table.ClientTableGets the ClientTable.org.apache.ignite3.table.mapper.Mapper<K>Gets the mapper for the keys used by this adapter.getName()Gets the name of this cache.org.apache.ignite3.sql.IgniteSqlgetSql()Returns the Ignite Sql API used by this adapted cache.org.apache.ignite3.table.mapper.Mapper<V>Gets the mapper for the values used by this adapter.booleanputIfAbsent(K key, V val) <R> CompletableFuture<org.apache.ignite.cache.query.QueryCursor<R>>query(org.apache.ignite.cache.query.Query<R> qry) Provides support for queries.CompletableFuture<org.apache.ignite.cache.query.QueryCursor<javax.cache.Cache.Entry<K,V>>> Provides support for ScanQueries using the SQL API.org.apache.ignite.cache.query.FieldsQueryCursor<List<?>>query(org.apache.ignite.cache.query.SqlFieldsQuery qry) size(org.apache.ignite.cache.CachePeekMode... peekModes)
-
Constructor Details
-
CacheAdapter
public CacheAdapter(ClientAdapter clientAdapter, org.apache.ignite3.sql.IgniteSql sql, org.apache.ignite3.internal.client.table.ClientTable clientTable, org.apache.ignite3.table.mapper.Mapper<K> keyMapper, org.apache.ignite3.table.mapper.Mapper<V> valueMapper, Supplier<org.apache.ignite3.tx.Transaction> txSupplier, CacheTableReference cacheRef) Constructor.- Parameters:
clientAdapter- Client Adapter.sql- IgniteSql API.clientTable- ClientTable.keyMapper- Mapper for the keys.valueMapper- Mapper for the values.txSupplier- Supplier for the current transaction.cacheRef- CacheTableReference.
-
-
Method Details
-
getClientTable
public org.apache.ignite3.internal.client.table.ClientTable getClientTable()Gets the ClientTable.- Returns:
- The ClientTable for this adapted cache.
-
getSql
public org.apache.ignite3.sql.IgniteSql getSql()Returns the Ignite Sql API used by this adapted cache.- Returns:
- IgniteSql API.
-
getKeyMapper
Gets the mapper for the keys used by this adapter.- Returns:
- The Key Mapper.
-
getValueMapper
Gets the mapper for the values used by this adapter.- Returns:
- The Value Mapper.
-
isInTransaction
public boolean isInTransaction()- Returns:
- Whether or not there's an active transaction.
-
getName
Gets the name of this cache.- Returns:
- Name of this cache.
-
get
Gets a value associated with a given key. CheckoutKeyValueView.get(Transaction, Object).- Parameters:
key- Key whose value is to be returned. The key cannot benull.- Returns:
- Value or
null, if it does not exist.
-
getAll
public CompletableFuture<Map<K,V>> getAll(Set<? extends K> keys) throws org.apache.ignite.transactions.TransactionException Get values associated with the given keys. CheckoutKeyValueView.getAllAsync(Transaction, Collection).- Parameters:
keys- Keys whose values are to be returned. The keys cannot benull.- Returns:
- Values associated with given keys. If a requested key does not exist, it will have no corresponding entry in the returned map.
- Throws:
org.apache.ignite.transactions.TransactionException
-
containsKey
public CompletableFuture<Boolean> containsKey(K key) throws org.apache.ignite.transactions.TransactionException - Throws:
org.apache.ignite.transactions.TransactionException
-
containsKeys
public CompletableFuture<Boolean> containsKeys(Set<? extends K> keys) throws org.apache.ignite.transactions.TransactionException - Throws:
org.apache.ignite.transactions.TransactionException
-
put
public CompletableFuture<Void> put(K key, V val) throws org.apache.ignite.transactions.TransactionException - Throws:
org.apache.ignite.transactions.TransactionException
-
getAndPut
public CompletableFuture<V> getAndPut(K key, V val) throws org.apache.ignite.transactions.TransactionException - Throws:
org.apache.ignite.transactions.TransactionException
-
getAndPutIfAbsent
public CompletableFuture<V> getAndPutIfAbsent(K key, V val) throws org.apache.ignite.transactions.TransactionException - Throws:
org.apache.ignite.transactions.TransactionException
-
putAll
public CompletableFuture<Void> putAll(Map<? extends K, ? extends V> map) throws org.apache.ignite.transactions.TransactionException- Throws:
org.apache.ignite.transactions.TransactionException
-
putIfAbsent
-
remove
public CompletableFuture<Boolean> remove(K key) throws org.apache.ignite.transactions.TransactionException - Throws:
org.apache.ignite.transactions.TransactionException
-
remove
public CompletableFuture<Boolean> remove(K key, V oldVal) throws org.apache.ignite.transactions.TransactionException - Throws:
org.apache.ignite.transactions.TransactionException
-
getAndRemove
public CompletableFuture<V> getAndRemove(K key) throws org.apache.ignite.transactions.TransactionException - Throws:
org.apache.ignite.transactions.TransactionException
-
replace
public CompletableFuture<Boolean> replace(K key, V oldVal, V newVal) throws org.apache.ignite.transactions.TransactionException - Throws:
org.apache.ignite.transactions.TransactionException
-
replace
public CompletableFuture<Boolean> replace(K key, V val) throws org.apache.ignite.transactions.TransactionException - Throws:
org.apache.ignite.transactions.TransactionException
-
getAndReplace
-
removeAll
-
removeAll
public CompletableFuture<Void> removeAll(Set<? extends K> keys) throws org.apache.ignite.transactions.TransactionException - Throws:
org.apache.ignite.transactions.TransactionException
-
clear
-
clear
-
clearAll
-
destroy
-
size
-
query
public <R> CompletableFuture<org.apache.ignite.cache.query.QueryCursor<R>> query(org.apache.ignite.cache.query.Query<R> qry) Provides support for queries.- Type Parameters:
R- Query Result type.- Parameters:
qry- Query.- Returns:
- The query result as a future.
-
query
public org.apache.ignite.cache.query.FieldsQueryCursor<List<?>> query(org.apache.ignite.cache.query.SqlFieldsQuery qry) -
query
public CompletableFuture<org.apache.ignite.cache.query.QueryCursor<javax.cache.Cache.Entry<K,V>>> query(org.apache.ignite.cache.query.ScanQuery<K, V> query) Provides support for ScanQueries using the SQL API.- Parameters:
query- ScanQuery.- Returns:
- A future holding the query result.
-