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

io.quarkus.redis.runtime.datasource.ReactiveTransactionalSetCommandsImpl Maven / Gradle / Ivy

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

import io.quarkus.redis.datasource.set.ReactiveTransactionalSetCommands;
import io.quarkus.redis.datasource.transactions.ReactiveTransactionalRedisDataSource;
import io.smallrye.mutiny.Uni;
import io.vertx.mutiny.redis.client.Response;

public class ReactiveTransactionalSetCommandsImpl extends AbstractTransactionalCommands
        implements ReactiveTransactionalSetCommands {

    private final ReactiveSetCommandsImpl reactive;

    public ReactiveTransactionalSetCommandsImpl(ReactiveTransactionalRedisDataSource ds, ReactiveSetCommandsImpl reactive,
            TransactionHolder tx) {
        super(ds, tx);
        this.reactive = reactive;
    }

    @Override
    public Uni sadd(K key, V... values) {
        this.tx.enqueue(Response::toInteger);
        return this.reactive._sadd(key, values).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni scard(K key) {
        this.tx.enqueue(Response::toLong);
        return this.reactive._scard(key).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni sdiff(K... keys) {
        this.tx.enqueue(this.reactive::decodeAsSetOfValues);
        return this.reactive._sdiff(keys).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni sdiffstore(K destination, K... keys) {
        this.tx.enqueue(Response::toLong);
        return this.reactive._sdiffstore(destination, keys).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni sinter(K... keys) {
        this.tx.enqueue(this.reactive::decodeAsSetOfValues);
        return this.reactive._sinter(keys).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni sintercard(K... keys) {
        this.tx.enqueue(Response::toLong);
        return this.reactive._sintercard(keys).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni sintercard(int limit, K... keys) {
        this.tx.enqueue(Response::toLong);
        return this.reactive._sintercard(limit, keys).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni sinterstore(K destination, K... keys) {
        this.tx.enqueue(Response::toLong);
        return this.reactive._sinterstore(destination, keys).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni sismember(K key, V member) {
        this.tx.enqueue(Response::toBoolean);
        return this.reactive._sismember(key, member).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni smembers(K key) {
        this.tx.enqueue(this.reactive::decodeAsSetOfValues);
        return this.reactive._smembers(key).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni smismember(K key, V... members) {
        this.tx.enqueue(this.reactive::decodeAsListOfBooleans);
        return this.reactive._smismember(key, members).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni smove(K source, K destination, V member) {
        this.tx.enqueue(Response::toBoolean);
        return this.reactive._smove(source, destination, member).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni spop(K key) {
        this.tx.enqueue(this.reactive::decodeV);
        return this.reactive._spop(key).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni spop(K key, int count) {
        this.tx.enqueue(this.reactive::decodeAsSetOfValues);
        return this.reactive._spop(key, count).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni srandmember(K key) {
        this.tx.enqueue(this.reactive::decodeV);
        return this.reactive._srandmember(key).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni srandmember(K key, int count) {
        this.tx.enqueue(this.reactive::decodeListOfValues);
        return this.reactive._srandmember(key, count).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni srem(K key, V... members) {
        this.tx.enqueue(Response::toInteger);
        return this.reactive._srem(key, members).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni sunion(K... keys) {
        this.tx.enqueue(resp -> this.reactive.decodeAsSetOfValues(resp));
        return this.reactive._sunion(keys).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni sunionstore(K destination, K... keys) {
        this.tx.enqueue(Response::toLong);
        return this.reactive._sunionstore(destination, keys).invoke(this::queuedOrDiscard).replaceWithVoid();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy