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

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

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

import java.util.List;
import java.util.Map;

import io.quarkus.redis.datasource.countmin.ReactiveTransactionalCountMinCommands;
import io.quarkus.redis.datasource.transactions.ReactiveTransactionalRedisDataSource;
import io.smallrye.mutiny.Uni;

public class ReactiveTransactionalCountMinCommandsImpl extends AbstractTransactionalCommands
        implements ReactiveTransactionalCountMinCommands {

    private final ReactiveCountMinCommandsImpl reactive;

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

    @Override
    public Uni cmsIncrBy(K key, V value, long increment) {
        this.tx.enqueue(r -> r.get(0).toLong()); // Uni
        return this.reactive._cmsIncrBy(key, value, increment).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni cmsIncrBy(K key, Map couples) {
        this.tx.enqueue(reactive::decodeAListOfLongs);
        return this.reactive._cmsIncrBy(key, couples).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni cmsInitByDim(K key, long width, long depth) {
        this.tx.enqueue(r -> null);
        return this.reactive._cmsInitByDim(key, width, depth).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni cmsInitByProb(K key, double error, double probability) {
        this.tx.enqueue(r -> null);
        return this.reactive._cmsInitByProb(key, error, probability).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni cmsQuery(K key, V item) {
        this.tx.enqueue(r -> reactive.decodeAListOfLongs(r).get(0));
        return this.reactive._cmsQuery(key, item).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni cmsQuery(K key, V... items) {
        this.tx.enqueue(reactive::decodeAListOfLongs);
        return this.reactive._cmsQuery(key, items).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni cmsMerge(K dest, List src, List weight) {
        this.tx.enqueue(r -> null);
        return this.reactive._cmsMerge(dest, src, weight).invoke(this::queuedOrDiscard).replaceWithVoid();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy