All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.quarkus.redis.datasource.transactions.TransactionalRedisDataSource Maven / Gradle / Ivy

There is a newer version: 3.17.5
Show newest version
package io.quarkus.redis.datasource.transactions;

import io.quarkus.redis.datasource.autosuggest.TransactionalAutoSuggestCommands;
import io.quarkus.redis.datasource.bitmap.TransactionalBitMapCommands;
import io.quarkus.redis.datasource.bloom.TransactionalBloomCommands;
import io.quarkus.redis.datasource.countmin.TransactionalCountMinCommands;
import io.quarkus.redis.datasource.cuckoo.TransactionalCuckooCommands;
import io.quarkus.redis.datasource.geo.TransactionalGeoCommands;
import io.quarkus.redis.datasource.graph.TransactionalGraphCommands;
import io.quarkus.redis.datasource.hash.TransactionalHashCommands;
import io.quarkus.redis.datasource.hyperloglog.TransactionalHyperLogLogCommands;
import io.quarkus.redis.datasource.json.TransactionalJsonCommands;
import io.quarkus.redis.datasource.keys.TransactionalKeyCommands;
import io.quarkus.redis.datasource.list.TransactionalListCommands;
import io.quarkus.redis.datasource.search.TransactionalSearchCommands;
import io.quarkus.redis.datasource.set.TransactionalSetCommands;
import io.quarkus.redis.datasource.sortedset.TransactionalSortedSetCommands;
import io.quarkus.redis.datasource.stream.TransactionalStreamCommands;
import io.quarkus.redis.datasource.string.TransactionalStringCommands;
import io.quarkus.redis.datasource.timeseries.TransactionalTimeSeriesCommands;
import io.quarkus.redis.datasource.topk.TransactionalTopKCommands;
import io.quarkus.redis.datasource.value.TransactionalValueCommands;
import io.smallrye.common.annotation.Experimental;
import io.vertx.mutiny.redis.client.Command;

/**
 * Redis Data Source object used to execute commands in a Redis transaction ({@code MULTI}).
 * Note that the results of the enqueued commands are not available until the completion of the transaction.
 */
public interface TransactionalRedisDataSource {

    /**
     * Discard the current transaction.
     */
    void discard();

    /**
     * Checks if the current transaction has been discarded by the user
     *
     * @return if the current transaction has been discarded by the user
     */
    boolean discarded();

    /**
     * Gets the object to execute commands manipulating hashes (a.k.a. {@code Map<F, V>}).
     * 

* If you want to use a hash of {@code <String -> Person>} stored using String identifier, you would use: * {@code hash(String.class, String.class, Person.class)}. * If you want to use a hash of {@code <String -> Person>} stored using UUID identifier, you would use: * {@code hash(UUID.class, String.class, Person.class)}. * * @param redisKeyType the class of the keys * @param typeOfField the class of the fields * @param typeOfValue the class of the values * @param the type of the redis key * @param the type of the fields (map's keys) * @param the type of the value * @return the object to execute commands manipulating hashes (a.k.a. {@code Map<K, V>}). */ TransactionalHashCommands hash(Class redisKeyType, Class typeOfField, Class typeOfValue); /** * Gets the object to execute commands manipulating hashes (a.k.a. {@code Map<String, V>}). *

* This is a shortcut on {@code hash(String.class, String.class, V)} * * @param typeOfValue the class of the values * @param the type of the value * @return the object to execute commands manipulating hashes (a.k.a. {@code Map<String, V>}). */ default TransactionalHashCommands hash(Class typeOfValue) { return hash(String.class, String.class, typeOfValue); } /** * Gets the object to execute commands manipulating geo items (a.k.a. {@code {longitude, latitude, member}}). *

* {@code V} represents the type of the member, i.e. the localized thing. * * @param redisKeyType the class of the keys * @param memberType the class of the members * @param the type of the redis key * @param the type of the member * @return the object to execute geo commands. */ TransactionalGeoCommands geo(Class redisKeyType, Class memberType); /** * Gets the object to execute commands manipulating geo items (a.k.a. {@code {longitude, latitude, member}}). *

* {@code V} represents the type of the member, i.e. the localized thing. * * @param memberType the class of the members * @param the type of the member * @return the object to execute geo commands. */ default TransactionalGeoCommands geo(Class memberType) { return geo(String.class, memberType); } /** * Gets the object to execute commands manipulating keys and expiration times. * * @param redisKeyType the type of the keys * @param the type of the key * @return the object to execute commands manipulating keys. */ TransactionalKeyCommands key(Class redisKeyType); /** * Gets the object to execute commands manipulating keys and expiration times. * * @return the object to execute commands manipulating keys. */ default TransactionalKeyCommands key() { return key(String.class); } /** * Gets the object to execute commands manipulating sorted sets. * * @param redisKeyType the type of the keys * @param valueType the type of the value sorted in the sorted sets * @param the type of the key * @param the type of the value * @return the object to manipulate sorted sets. */ TransactionalSortedSetCommands sortedSet(Class redisKeyType, Class valueType); /** * Gets the object to execute commands manipulating sorted sets. * * @param valueType the type of the value sorted in the sorted sets * @param the type of the value * @return the object to manipulate sorted sets. */ default TransactionalSortedSetCommands sortedSet(Class valueType) { return sortedSet(String.class, valueType); } /** * Gets the object to execute commands manipulating stored strings. * *

* NOTE: Instead of {@code string}, this group is named {@code value} to avoid the confusion with the * Java String type. Indeed, Redis strings can be strings, numbers, byte arrays... * * @param redisKeyType the type of the keys * @param valueType the type of the value, often String, or the value are encoded/decoded using codecs. * @param the type of the key * @param the type of the value * @return the object to manipulate stored strings. */ TransactionalValueCommands value(Class redisKeyType, Class valueType); /** * Gets the object to execute commands manipulating stored strings. * *

* NOTE: Instead of {@code string}, this group is named {@code value} to avoid the confusion with the * Java String type. Indeed, Redis strings can be strings, numbers, byte arrays... * * @param valueType the type of the value, often String, or the value are encoded/decoded using codecs. * @param the type of the value * @return the object to manipulate stored strings. */ default TransactionalValueCommands value(Class valueType) { return value(String.class, valueType); } /** * Gets the object to execute commands manipulating stored strings. * * @param redisKeyType the type of the keys * @param valueType the type of the value, often String, or the value are encoded/decoded using codecs. * @param the type of the key * @param the type of the value * @return the object to manipulate stored strings. * @deprecated Use {@link #value(Class, Class)} instead. */ @Deprecated TransactionalStringCommands string(Class redisKeyType, Class valueType); /** * Gets the object to execute commands manipulating stored strings. * * @param valueType the type of the value, often String, or the value are encoded/decoded using codecs. * @param the type of the value * @return the object to manipulate stored strings. * @deprecated Use {@link #value(Class)} instead */ @Deprecated default TransactionalStringCommands string(Class valueType) { return string(String.class, valueType); } /** * Gets the object to execute commands manipulating sets. * * @param redisKeyType the type of the keys * @param memberType the type of the member stored in each set * @param the type of the key * @param the type of the member * @return the object to manipulate sets. */ TransactionalSetCommands set(Class redisKeyType, Class memberType); /** * Gets the object to execute commands manipulating sets. * * @param memberType the type of the member stored in each set * @param the type of the member * @return the object to manipulate sets. */ default TransactionalSetCommands set(Class memberType) { return set(String.class, memberType); } /** * Gets the object to execute commands manipulating lists. * * @param redisKeyType the type of the keys * @param memberType the type of the member stored in each list * @param the type of the key * @param the type of the member * @return the object to manipulate sets. */ TransactionalListCommands list(Class redisKeyType, Class memberType); /** * Gets the object to execute commands manipulating lists. * * @param memberType the type of the member stored in each list * @param the type of the member * @return the object to manipulate sets. */ default TransactionalListCommands list(Class memberType) { return list(String.class, memberType); } /** * Gets the object to execute commands manipulating hyperloglog data structures. * * @param redisKeyType the type of the keys * @param memberType the type of the member stored in the data structure * @param the type of the key * @param the type of the member * @return the object to manipulate hyper log log data structures. */ TransactionalHyperLogLogCommands hyperloglog(Class redisKeyType, Class memberType); /** * Gets the object to execute commands manipulating hyperloglog data structures. * * @param memberType the type of the member stored in the data structure * @param the type of the member * @return the object to manipulate hyper log log data structures. */ default TransactionalHyperLogLogCommands hyperloglog(Class memberType) { return hyperloglog(String.class, memberType); } /** * Gets the object to execute commands manipulating bitmap data structures. * * @param redisKeyType the type of the keys * @param the type of the key * @return the object to manipulate bitmap data structures. */ TransactionalBitMapCommands bitmap(Class redisKeyType); /** * Gets the object to execute commands manipulating bitmap data structures. * * @return the object to manipulate bitmap data structures. */ default TransactionalBitMapCommands bitmap() { return bitmap(String.class); } /** * Gets the object to execute commands manipulating streams. *

* * @param redisKeyType the class of the keys * @param typeOfField the class of the fields * @param typeOfValue the class of the values * @param the type of the redis key * @param the type of the fields (map's keys) * @param the type of the value * @return the object to execute commands manipulating streams. */ TransactionalStreamCommands stream(Class redisKeyType, Class typeOfField, Class typeOfValue); /** * Gets the object to execute commands manipulating stream.. *

* This is a shortcut on {@code stream(String.class, String.class, V)} * * @param typeOfValue the class of the values * @param the type of the value * @return the object to execute commands manipulating streams. */ default TransactionalStreamCommands stream(Class typeOfValue) { return stream(String.class, String.class, typeOfValue); } /** * Gets the object to manipulate JSON values. * This group requires the RedisJSON module. * * @return the object to manipulate JSON values. */ default TransactionalJsonCommands json() { return json(String.class); } /** * Gets the object to manipulate JSON values. * This group requires the RedisJSON module. * * @param the type of keys * @return the object to manipulate JSON values. */ TransactionalJsonCommands json(Class redisKeyType); /** * Gets the object to manipulate Bloom filters. * This group requires the RedisBloom module. * * @param valueType the type of value to store in the filters * @param the type of value * @return the object to manipulate Bloom filters */ default TransactionalBloomCommands bloom(Class valueType) { return bloom(String.class, valueType); } /** * Gets the object to manipulate Bloom filters. * This group requires the RedisBloom module. * * @param redisKeyType the type of the key * @param valueType the type of value to store in the filters * @param the type of key * @param the type of value * @return the object to manipulate Bloom filters */ TransactionalBloomCommands bloom(Class redisKeyType, Class valueType); /** * Gets the object to manipulate Cuckoo filters. * This group requires the RedisBloom module (including the Cuckoo * filter support). * * @param the type of the values added into the Cuckoo filter * @return the object to manipulate Cuckoo values. */ default TransactionalCuckooCommands cuckoo(Class valueType) { return cuckoo(String.class, valueType); } /** * Gets the object to manipulate Cuckoo filters. * This group requires the RedisBloom module (including the Cuckoo * filter support). * * @param the type of keys * @param the type of the values added into the Cuckoo filter * @return the object to manipulate Cuckoo values. */ TransactionalCuckooCommands cuckoo(Class redisKeyType, Class valueType); /** * Gets the object to manipulate Count-Min sketches. * This group requires the RedisBloom module (including the count-min * sketches support). * * @param the type of the values added into the count-min sketches * @return the object to manipulate count-min sketches. */ default TransactionalCountMinCommands countmin(Class valueType) { return countmin(String.class, valueType); } /** * Gets the object to manipulate Count-Min sketches. * This group requires the RedisBloom module (including the count-min * sketches support). * * @param the type of keys * @param the type of the values added into the count-min sketches * @return the object to manipulate count-min sketches. */ TransactionalCountMinCommands countmin(Class redisKeyType, Class valueType); /** * Gets the object to manipulate Top-K list. * This group requires the RedisBloom module (including the top-k * list support). * * @param the type of the values added into the top-k lists * @return the object to manipulate top-k lists. */ default TransactionalTopKCommands topk(Class valueType) { return topk(String.class, valueType); } /** * Gets the object to manipulate Top-K list. * This group requires the RedisBloom module (including the top-k * list support). * * @param the type of keys * @param the type of the values added into the top-k lists * @return the object to manipulate top-k lists. */ TransactionalTopKCommands topk(Class redisKeyType, Class valueType); /** * Gets the object to manipulate graphs. * This group requires the RedisGraph module. * * @return the object to manipulate graphs lists. */ @Experimental("The Redis graph support is experimental") default TransactionalGraphCommands graph() { return graph(String.class); } /** * Gets the object to manipulate graphs. * This group requires the RedisGraph module. * * @param the type of keys * @return the object to manipulate graphs lists. */ @Experimental("The Redis graph support is experimental") TransactionalGraphCommands graph(Class redisKeyType); /** * Gets the object to emit commands from the {@code search} group. * This group requires the RedisSearch module. * * @param the type of keys * @return the object to search documents */ @Experimental("The Redis search support is experimental") TransactionalSearchCommands search(Class redisKeyType); /** * Gets the object to emit commands from the {@code search} group. * This group requires the RedisSearch module. * * @return the object to search documents */ @Experimental("The Redis Search support is experimental") default TransactionalSearchCommands search() { return search(String.class); } /** * Gets the object to emit commands from the {@code auto-suggest} group. * This group requires the RedisSearch module. * * @param the type of keys * @return the object to get suggestions */ @Experimental("The Redis auto-suggest support is experimental") TransactionalAutoSuggestCommands autosuggest(Class redisKeyType); /** * Gets the object to emit commands from the {@code auto-suggest} group. * This group requires the RedisSearch module. * * @return the object to get suggestions */ @Experimental("The Redis auto-suggest support is experimental") default TransactionalAutoSuggestCommands autosuggest() { return autosuggest(String.class); } /** * Gets the object to emit commands from the {@code time series} group. * This group requires the Redis Time Series module. * * @param the type of keys * @return the object to manipulate time series */ @Experimental("The Redis time series support is experimental") TransactionalTimeSeriesCommands timeseries(Class redisKeyType); /** * Gets the object to emit commands from the {@code time series} group. * This group requires the Redis Time Series module. * * @return the object to manipulate time series */ @Experimental("The Redis time series support is experimental") default TransactionalTimeSeriesCommands timeseries() { return timeseries(String.class); } /** * Executes a command. * This method is used to execute commands not offered by the API. * * @param command the command name * @param args the parameters, encoded as String. */ void execute(String command, String... args); /** * Executes a command. * This method is used to execute commands not offered by the API. * * @param command the command * @param args the parameters, encoded as String. */ void execute(Command command, String... args); /** * Executes a command. * This method is used to execute commands not offered by the API. * * @param command the command * @param args the parameters, encoded as String. */ void execute(io.vertx.redis.client.Command command, String... args); }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy