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

io.quarkus.redis.runtime.datasource.ReactiveTransactionalAutoSuggestCommandsImpl 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.autosuggest.GetArgs;
import io.quarkus.redis.datasource.autosuggest.ReactiveTransactionalAutoSuggestCommands;
import io.quarkus.redis.datasource.transactions.ReactiveTransactionalRedisDataSource;
import io.smallrye.mutiny.Uni;
import io.vertx.mutiny.redis.client.Response;

public class ReactiveTransactionalAutoSuggestCommandsImpl extends AbstractTransactionalCommands
        implements ReactiveTransactionalAutoSuggestCommands {

    private final ReactiveAutoSuggestCommandsImpl reactive;

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

    @Override
    public Uni ftSugAdd(K key, String string, double score, boolean increment) {
        this.tx.enqueue(Response::toLong); // Uni
        return this.reactive._ftSugAdd(key, string, score, increment).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni ftSugDel(K key, String string) {
        this.tx.enqueue(Response::toBoolean); // Uni
        return this.reactive._ftSugDel(key, string).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni ftSugget(K key, String prefix) {
        this.tx.enqueue(r -> reactive.decodeAsListOfSuggestion(r, false));
        return this.reactive._ftSugget(key, prefix).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni ftSugget(K key, String prefix, GetArgs args) {
        this.tx.enqueue(r -> reactive.decodeAsListOfSuggestion(r, args.hasScores()));
        return this.reactive._ftSugget(key, prefix, args).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy