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

io.quarkus.redis.runtime.datasource.ReactiveTransactionalGraphCommandsImpl 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.graph.ReactiveTransactionalGraphCommands;
import io.quarkus.redis.datasource.transactions.ReactiveTransactionalRedisDataSource;
import io.smallrye.mutiny.Uni;
import io.vertx.mutiny.redis.client.Response;

public class ReactiveTransactionalGraphCommandsImpl extends AbstractTransactionalCommands
        implements ReactiveTransactionalGraphCommands {

    private final ReactiveGraphCommandsImpl reactive;

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

    @Override
    public Uni graphDelete(K key) {
        this.tx.enqueue(x -> null);
        return this.reactive._graphDelete(key).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni graphExplain(K key, String query) {
        this.tx.enqueue(Response::toString);
        return this.reactive._graphExplain(key, query).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni graphList() {
        this.tx.enqueue(r -> reactive.marshaller.decodeAsList(r, reactive.typeOfKey));
        return this.reactive._graphList().invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni graphQuery(K key, String query) {
        this.tx.enqueue(ReactiveGraphCommandsImpl::decodeQueryResponse); // Uni>>
        return this.reactive._graphQuery(key, query).invoke(this::queuedOrDiscard).replaceWithVoid();
    }

    @Override
    public Uni graphQuery(K key, String query, Duration timeout) {
        this.tx.enqueue(ReactiveGraphCommandsImpl::decodeQueryResponse); // Uni>>
        return this.reactive._graphQuery(key, query, timeout).invoke(this::queuedOrDiscard).replaceWithVoid();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy