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

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

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

import java.time.Duration;

import io.quarkus.redis.datasource.list.LPosArgs;
import io.quarkus.redis.datasource.list.Position;
import io.quarkus.redis.datasource.list.ReactiveTransactionalListCommands;
import io.quarkus.redis.datasource.transactions.ReactiveTransactionalRedisDataSource;
import io.smallrye.mutiny.Uni;
import io.vertx.mutiny.redis.client.Response;

public class ReactiveTransactionalListCommandsImpl extends AbstractTransactionalCommands
        implements ReactiveTransactionalListCommands {

    private final ReactiveListCommandsImpl reactive;

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

    @Override
    public Uni blmove(K source, K destination, Position positionInSource, Position positionInDest, Duration timeout) {
        this.tx.enqueue(this.reactive::decodeV);
        return this.reactive._blmove(source, destination, positionInSource, positionInDest, timeout)
                .invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni blmpop(Duration timeout, Position position, K... keys) {
        this.tx.enqueue(this.reactive::decodeKeyValueWithList);
        return this.reactive._blmpop(timeout, position, keys).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni blmpop(Duration timeout, Position position, int count, K... keys) {
        this.tx.enqueue(this.reactive::decodeListOfKeyValue);
        return this.reactive._blmpop(timeout, position, count, keys).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni blpop(Duration timeout, K... keys) {
        this.tx.enqueue(this.reactive::decodeKeyValue);
        return this.reactive._blpop(timeout, keys).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni brpop(Duration timeout, K... keys) {
        this.tx.enqueue(this.reactive::decodeKeyValue);
        return this.reactive._brpop(timeout, keys).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Deprecated
    @Override
    public Uni brpoplpush(Duration timeout, K source, K destination) {
        this.tx.enqueue(this.reactive::decodeV);
        return this.reactive._brpoplpush(timeout, source, destination).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni lindex(K key, long index) {
        this.tx.enqueue(this.reactive::decodeV);
        return this.reactive._lindex(key, index).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni linsertBeforePivot(K key, V pivot, V element) {
        this.tx.enqueue(Response::toLong);
        return this.reactive._linsertBeforePivot(key, pivot, element).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni linsertAfterPivot(K key, V pivot, V element) {
        this.tx.enqueue(Response::toLong);
        return this.reactive._linsertAfterPivot(key, pivot, element).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

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

    @Override
    public Uni lmove(K source, K destination, Position positionInSource, Position positionInDestination) {
        this.tx.enqueue(this.reactive::decodeV);
        return this.reactive._lmove(source, destination, positionInSource, positionInDestination).invoke(this::queuedOrDiscard)
                .replaceWithVoid();
    }

    @Override
    public Uni lmpop(Position position, K... keys) {
        this.tx.enqueue(this.reactive::decodeKeyValueWithList);
        return this.reactive._lmpop(position, keys).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni lmpop(Position position, int count, K... keys) {
        this.tx.enqueue(this.reactive::decodeListOfKeyValue);
        return this.reactive._lmpop(position, count, keys).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

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

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

    @Override
    public Uni lpos(K key, V element) {
        this.tx.enqueue(this.reactive::decodeLongOrNull);
        return this.reactive._lpos(key, element).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni lpos(K key, V element, LPosArgs args) {
        this.tx.enqueue(this.reactive::decodeLongOrNull);
        return this.reactive._lpos(key, element, args).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni lpos(K key, V element, int count) {
        this.tx.enqueue(this.reactive::decodeListOfLongs);
        return this.reactive._lpos(key, element, count).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni lpos(K key, V element, int count, LPosArgs args) {
        this.tx.enqueue(this.reactive::decodeListOfLongs);
        return this.reactive._lpos(key, element, count, args).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni lpush(K key, V... elements) {
        this.tx.enqueue(Response::toLong);
        return this.reactive._lpush(key, elements).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni lpushx(K key, V... elements) {
        this.tx.enqueue(Response::toLong);
        return this.reactive._lpushx(key, elements).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni lrange(K key, long start, long stop) {
        this.tx.enqueue(this.reactive::decodeListV);
        return this.reactive._lrange(key, start, stop).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni lrem(K key, long count, V element) {
        this.tx.enqueue(Response::toLong);
        return this.reactive._lrem(key, count, element).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni lset(K key, long index, V element) {
        this.tx.enqueue(resp -> null);
        return this.reactive._lset(key, index, element).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni ltrim(K key, long start, long stop) {
        this.tx.enqueue(resp -> null);
        return this.reactive._ltrim(key, start, stop).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

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

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

    @Deprecated
    @Override
    public Uni rpoplpush(K source, K destination) {
        this.tx.enqueue(this.reactive::decodeV);
        return this.reactive._rpoplpush(source, destination).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy