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

io.quarkus.redis.runtime.datasource.BlockingSortedSetCommandsImpl 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 java.util.List;
import java.util.Map;
import java.util.OptionalDouble;
import java.util.OptionalLong;
import java.util.stream.Collectors;

import io.quarkus.redis.datasource.RedisDataSource;
import io.quarkus.redis.datasource.ScanArgs;
import io.quarkus.redis.datasource.SortArgs;
import io.quarkus.redis.datasource.list.KeyValue;
import io.quarkus.redis.datasource.sortedset.Range;
import io.quarkus.redis.datasource.sortedset.ReactiveSortedSetCommands;
import io.quarkus.redis.datasource.sortedset.ScoreRange;
import io.quarkus.redis.datasource.sortedset.ScoredValue;
import io.quarkus.redis.datasource.sortedset.SortedSetCommands;
import io.quarkus.redis.datasource.sortedset.ZAddArgs;
import io.quarkus.redis.datasource.sortedset.ZAggregateArgs;
import io.quarkus.redis.datasource.sortedset.ZRangeArgs;
import io.quarkus.redis.datasource.sortedset.ZScanCursor;

public class BlockingSortedSetCommandsImpl extends AbstractRedisCommandGroup implements SortedSetCommands {

    private final ReactiveSortedSetCommands reactive;

    public BlockingSortedSetCommandsImpl(RedisDataSource ds, ReactiveSortedSetCommands reactive, Duration timeout) {
        super(ds, timeout);
        this.reactive = reactive;
    }

    @Override
    public boolean zadd(K key, double score, V member) {
        return reactive.zadd(key, score, member)
                .await().atMost(timeout);
    }

    @Override
    public int zadd(K key, Map items) {
        return reactive.zadd(key, items)
                .await().atMost(timeout);
    }

    @SafeVarargs
    @Override
    public final int zadd(K key, ScoredValue... items) {
        return reactive.zadd(key, items)
                .await().atMost(timeout);
    }

    @Override
    public boolean zadd(K key, ZAddArgs zAddArgs, double score, V member) {
        return reactive.zadd(key, zAddArgs, score, member)
                .await().atMost(timeout);
    }

    @Override
    public int zadd(K key, ZAddArgs zAddArgs, Map items) {
        return reactive.zadd(key, zAddArgs, items)
                .await().atMost(timeout);
    }

    @SafeVarargs
    @Override
    public final int zadd(K key, ZAddArgs zAddArgs, ScoredValue... items) {
        return reactive.zadd(key, zAddArgs, items)
                .await().atMost(timeout);
    }

    @Override
    public double zaddincr(K key, double score, V member) {
        return reactive.zaddincr(key, score, member)
                .await().atMost(timeout);
    }

    @Override
    public OptionalDouble zaddincr(K key, ZAddArgs zAddArgs, double score, V member) {
        return reactive.zaddincr(key, zAddArgs, score, member)
                .map(d -> {
                    if (d == null) {
                        return OptionalDouble.empty();
                    }
                    return OptionalDouble.of(d);
                })
                .await().atMost(timeout);
    }

    @Override
    public long zcard(K key) {
        return reactive.zcard(key)
                .await().atMost(timeout);
    }

    @Override
    public long zcount(K key, ScoreRange range) {
        return reactive.zcount(key, range)
                .await().atMost(timeout);
    }

    @Override
    public List zdiff(K... keys) {
        return reactive.zdiff(keys)
                .await().atMost(timeout);
    }

    @Override
    public List> zdiffWithScores(K... keys) {
        return reactive.zdiffWithScores(keys)
                .await().atMost(timeout);
    }

    @Override
    public long zdiffstore(K destination, K... keys) {
        return reactive.zdiffstore(destination, keys)
                .await().atMost(timeout);
    }

    @Override
    public double zincrby(K key, double increment, V member) {
        return reactive.zincrby(key, increment, member)
                .await().atMost(timeout);
    }

    @Override
    public List zinter(ZAggregateArgs arguments, K... keys) {
        return reactive.zinter(arguments, keys)
                .await().atMost(timeout);
    }

    @Override
    public List zinter(K... keys) {
        return reactive.zinter(keys)
                .await().atMost(timeout);
    }

    @Override
    public List> zinterWithScores(ZAggregateArgs arguments, K... keys) {
        return reactive.zinterWithScores(arguments, keys)
                .await().atMost(timeout);
    }

    @Override
    public List> zinterWithScores(K... keys) {
        return reactive.zinterWithScores(keys)
                .await().atMost(timeout);
    }

    @Override
    public long zintercard(K... keys) {
        return reactive.zintercard(keys)
                .await().atMost(timeout);
    }

    @Override
    public long zintercard(long limit, K... keys) {
        return reactive.zintercard(limit, keys)
                .await().atMost(timeout);
    }

    @Override
    public long zinterstore(K destination, ZAggregateArgs arguments, K... keys) {
        return reactive.zinterstore(destination, arguments, keys)
                .await().atMost(timeout);
    }

    @Override
    public long zinterstore(K destination, K... keys) {
        return reactive.zinterstore(destination, keys)
                .await().atMost(timeout);
    }

    @Override
    public long zlexcount(K key, Range range) {
        return reactive.zlexcount(key, range)
                .await().atMost(timeout);
    }

    @Override
    public ScoredValue zmpopMin(K... keys) {
        return reactive.zmpopMin(keys)
                .await().atMost(timeout);
    }

    @Override
    public List> zmpopMin(int count, K... keys) {
        return reactive.zmpopMin(count, keys)
                .await().atMost(timeout);
    }

    @Override
    public ScoredValue zmpopMax(K... keys) {
        return reactive.zmpopMax(keys)
                .await().atMost(timeout);
    }

    @Override
    public List> zmpopMax(int count, K... keys) {
        return reactive.zmpopMax(count, keys)
                .await().atMost(timeout);
    }

    @Override
    public ScoredValue bzmpopMin(Duration timeout, K... keys) {
        return reactive.bzmpopMin(timeout, keys)
                .await().atMost(this.timeout);
    }

    @Override
    public List> bzmpopMin(Duration timeout, int count, K... keys) {
        return reactive.bzmpopMin(timeout, count, keys)
                .await().atMost(this.timeout);
    }

    @Override
    public ScoredValue bzmpopMax(Duration timeout, K... keys) {
        return reactive.bzmpopMax(timeout, keys)
                .await().atMost(this.timeout);
    }

    @Override
    public List> bzmpopMax(Duration timeout, int count, K... keys) {
        return reactive.bzmpopMax(timeout, count, keys)
                .await().atMost(this.timeout);
    }

    @Override
    public List zmscore(K key, V... members) {
        return reactive.zmscore(key, members)
                .map(list -> list.stream().map(d -> {
                    if (d == null) {
                        return OptionalDouble.empty();
                    }
                    return OptionalDouble.of(d);
                }).collect(Collectors.toList()))
                .await().atMost(timeout);
    }

    @Override
    public ScoredValue zpopmax(K key) {
        return reactive.zpopmax(key)
                .await().atMost(timeout);
    }

    @Override
    public List> zpopmax(K key, int count) {
        return reactive.zpopmax(key, count)
                .await().atMost(timeout);
    }

    @Override
    public ScoredValue zpopmin(K key) {
        return reactive.zpopmin(key)
                .await().atMost(timeout);
    }

    @Override
    public List> zpopmin(K key, int count) {
        return reactive.zpopmin(key, count)
                .await().atMost(timeout);
    }

    @Override
    public V zrandmember(K key) {
        return reactive.zrandmember(key)
                .await().atMost(timeout);
    }

    @Override
    public List zrandmember(K key, int count) {
        return reactive.zrandmember(key, count)
                .await().atMost(timeout);
    }

    @Override
    public ScoredValue zrandmemberWithScores(K key) {
        return reactive.zrandmemberWithScores(key)
                .await().atMost(timeout);
    }

    @Override
    public List> zrandmemberWithScores(K key, int count) {
        return reactive.zrandmemberWithScores(key, count)
                .await().atMost(timeout);
    }

    @Override
    public KeyValue> bzpopmin(Duration timeout, K... keys) {
        return reactive.bzpopmin(timeout, keys)
                .await().atMost(this.timeout);
    }

    @Override
    public KeyValue> bzpopmax(Duration timeout, K... keys) {
        return reactive.bzpopmax(timeout, keys)
                .await().atMost(this.timeout);
    }

    @Override
    public List zrange(K key, long start, long stop, ZRangeArgs args) {
        return reactive.zrange(key, start, stop, args)
                .await().atMost(timeout);
    }

    @Override
    public List> zrangeWithScores(K key, long start, long stop, ZRangeArgs args) {
        return reactive.zrangeWithScores(key, start, stop, args)
                .await().atMost(timeout);
    }

    @Override
    public List zrange(K key, long start, long stop) {
        return reactive.zrange(key, start, stop)
                .await().atMost(timeout);
    }

    @Override
    public List> zrangeWithScores(K key, long start, long stop) {
        return reactive.zrangeWithScores(key, start, stop)
                .await().atMost(timeout);
    }

    @Override
    public List zrangebylex(K key, Range range, ZRangeArgs args) {
        return reactive.zrangebylex(key, range, args)
                .await().atMost(timeout);
    }

    @Override
    public List zrangebylex(K key, Range range) {
        return reactive.zrangebylex(key, range)
                .await().atMost(timeout);
    }

    @Override
    public List zrangebyscore(K key, ScoreRange range, ZRangeArgs args) {
        return reactive.zrangebyscore(key, range, args)
                .await().atMost(timeout);
    }

    @Override
    public List> zrangebyscoreWithScores(K key, ScoreRange range, ZRangeArgs args) {
        return reactive.zrangebyscoreWithScores(key, range, args)
                .await().atMost(timeout);
    }

    @Override
    public List zrangebyscore(K key, ScoreRange range) {
        return reactive.zrangebyscore(key, range)
                .await().atMost(timeout);
    }

    @Override
    public List> zrangebyscoreWithScores(K key, ScoreRange range) {
        return reactive.zrangebyscoreWithScores(key, range)
                .await().atMost(timeout);
    }

    @Override
    public long zrangestore(K dst, K src, long min, long max, ZRangeArgs args) {
        return reactive.zrangestore(dst, src, min, max, args)
                .await().atMost(timeout);
    }

    @Override
    public long zrangestore(K dst, K src, long min, long max) {
        return reactive.zrangestore(dst, src, min, max)
                .await().atMost(timeout);
    }

    @Override
    public long zrangestorebylex(K dst, K src, Range range, ZRangeArgs args) {
        return reactive.zrangestorebylex(dst, src, range, args)
                .await().atMost(timeout);
    }

    @Override
    public long zrangestorebylex(K dst, K src, Range range) {
        return reactive.zrangestorebylex(dst, src, range)
                .await().atMost(timeout);
    }

    @Override
    public long zrangestorebyscore(K dst, K src, ScoreRange range, ZRangeArgs args) {
        return reactive.zrangestorebyscore(dst, src, range, args)
                .await().atMost(timeout);
    }

    @Override
    public long zrangestorebyscore(K dst, K src, ScoreRange range) {
        return reactive.zrangestorebyscore(dst, src, range)
                .await().atMost(timeout);
    }

    @Override
    public OptionalLong zrank(K key, V member) {
        return reactive.zrank(key, member)
                .map(l -> {
                    if (l == null) {
                        return OptionalLong.empty();
                    } else {
                        return OptionalLong.of(l);
                    }
                })
                .await().atMost(timeout);
    }

    @Override
    public int zrem(K key, V... members) {
        return reactive.zrem(key, members)
                .await().atMost(timeout);
    }

    @Override
    public long zremrangebylex(K key, Range range) {
        return reactive.zremrangebylex(key, range)
                .await().atMost(timeout);
    }

    @Override
    public long zremrangebyrank(K key, long start, long stop) {
        return reactive.zremrangebyrank(key, start, stop)
                .await().atMost(timeout);
    }

    @Override
    public long zremrangebyscore(K key, ScoreRange range) {
        return reactive.zremrangebyscore(key, range)
                .await().atMost(timeout);
    }

    @Override
    public OptionalLong zrevrank(K key, V member) {
        return reactive.zrevrank(key, member)
                .map(l -> {
                    if (l == null) {
                        return OptionalLong.empty();
                    }
                    return OptionalLong.of(l);
                })
                .await().atMost(timeout);
    }

    @Override
    public ZScanCursor zscan(K key) {
        return new ZScanBlockingCursorImpl<>(reactive.zscan(key), timeout);
    }

    @Override
    public ZScanCursor zscan(K key, ScanArgs args) {
        return new ZScanBlockingCursorImpl<>(reactive.zscan(key, args), timeout);
    }

    @Override
    public OptionalDouble zscore(K key, V member) {
        return reactive.zscore(key, member)
                .map(score -> {
                    if (score == null) {
                        return OptionalDouble.empty();
                    }
                    return OptionalDouble.of(score);
                })
                .await().atMost(timeout);
    }

    @Override
    public List zunion(ZAggregateArgs args, K... keys) {
        return reactive.zunion(args, keys)
                .await().atMost(timeout);
    }

    @Override
    public List zunion(K... keys) {
        return reactive.zunion(keys)
                .await().atMost(timeout);
    }

    @Override
    public List> zunionWithScores(ZAggregateArgs args, K... keys) {
        return reactive.zunionWithScores(args, keys)
                .await().atMost(timeout);
    }

    @Override
    public List> zunionWithScores(K... keys) {
        return reactive.zunionWithScores(keys)
                .await().atMost(timeout);
    }

    @Override
    public long zunionstore(K destination, ZAggregateArgs args, K... keys) {
        return reactive.zunionstore(destination, args, keys)
                .await().atMost(timeout);
    }

    @Override
    public long zunionstore(K destination, K... keys) {
        return reactive.zunionstore(destination, keys)
                .await().atMost(timeout);
    }

    @Override
    public List sort(K key) {
        return reactive.sort(key)
                .await().atMost(timeout);
    }

    @Override
    public List sort(K key, SortArgs sortArguments) {
        return reactive.sort(key, sortArguments)
                .await().atMost(timeout);
    }

    @Override
    public long sortAndStore(K key, K destination, SortArgs sortArguments) {
        return reactive.sortAndStore(key, destination, sortArguments)
                .await().atMost(timeout);
    }

    @Override
    public long sortAndStore(K key, K destination) {
        return reactive.sortAndStore(key, destination)
                .await().atMost(timeout);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy