io.quarkus.redis.runtime.datasource.ReactiveTimeSeriesCommandsImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-redis-client Show documentation
Show all versions of quarkus-redis-client Show documentation
Connect to Redis in either imperative or reactive style
package io.quarkus.redis.runtime.datasource;
import java.lang.reflect.Type;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import io.quarkus.redis.datasource.ReactiveRedisCommands;
import io.quarkus.redis.datasource.ReactiveRedisDataSource;
import io.quarkus.redis.datasource.timeseries.AddArgs;
import io.quarkus.redis.datasource.timeseries.Aggregation;
import io.quarkus.redis.datasource.timeseries.AlterArgs;
import io.quarkus.redis.datasource.timeseries.CreateArgs;
import io.quarkus.redis.datasource.timeseries.Filter;
import io.quarkus.redis.datasource.timeseries.IncrementArgs;
import io.quarkus.redis.datasource.timeseries.MGetArgs;
import io.quarkus.redis.datasource.timeseries.MRangeArgs;
import io.quarkus.redis.datasource.timeseries.RangeArgs;
import io.quarkus.redis.datasource.timeseries.ReactiveTimeSeriesCommands;
import io.quarkus.redis.datasource.timeseries.Sample;
import io.quarkus.redis.datasource.timeseries.SampleGroup;
import io.quarkus.redis.datasource.timeseries.SeriesSample;
import io.quarkus.redis.datasource.timeseries.TimeSeriesRange;
import io.smallrye.mutiny.Uni;
import io.vertx.mutiny.redis.client.Response;
import io.vertx.redis.client.ResponseType;
public class ReactiveTimeSeriesCommandsImpl extends AbstractTimeSeriesCommands
implements ReactiveTimeSeriesCommands, ReactiveRedisCommands {
private final ReactiveRedisDataSource reactive;
protected final Type keyType;
public ReactiveTimeSeriesCommandsImpl(ReactiveRedisDataSourceImpl redis, Type k) {
super(redis, k);
this.keyType = k;
this.reactive = redis;
}
@Override
public ReactiveRedisDataSource getDataSource() {
return reactive;
}
@Override
public Uni tsCreate(K key, CreateArgs args) {
return super._tsCreate(key, args)
.replaceWithVoid();
}
@Override
public Uni tsCreate(K key) {
return super._tsCreate(key)
.replaceWithVoid();
}
@Override
public Uni tsAdd(K key, long timestamp, double value, AddArgs args) {
return super._tsAdd(key, timestamp, value, args)
.replaceWithVoid();
}
@Override
public Uni tsAdd(K key, double value, AddArgs args) {
return super._tsAdd(key, value, args)
.replaceWithVoid();
}
@Override
public Uni tsAdd(K key, long timestamp, double value) {
return super._tsAdd(key, timestamp, value)
.replaceWithVoid();
}
@Override
public Uni tsAdd(K key, double value) {
return super._tsAdd(key, value)
.replaceWithVoid();
}
@Override
public Uni tsAlter(K key, AlterArgs args) {
return super._tsAlter(key, args)
.replaceWithVoid();
}
@Override
public Uni tsCreateRule(K key, K destKey, Aggregation aggregation, Duration bucketDuration) {
return super._tsCreateRule(key, destKey, aggregation, bucketDuration)
.replaceWithVoid();
}
@Override
public Uni tsCreateRule(K key, K destKey, Aggregation aggregation, Duration bucketDuration, long alignTimestamp) {
return super._tsCreateRule(key, destKey, aggregation, bucketDuration, alignTimestamp)
.replaceWithVoid();
}
@Override
public Uni tsDecrBy(K key, double value) {
return super._tsDecrBy(key, value)
.replaceWithVoid();
}
@Override
public Uni tsDecrBy(K key, double value, IncrementArgs args) {
return super._tsDecrBy(key, value, args)
.replaceWithVoid();
}
@Override
public Uni tsDel(K key, long fromTimestamp, long toTimestamp) {
return super._tsDel(key, fromTimestamp, toTimestamp)
.replaceWithVoid();
}
@Override
public Uni tsDeleteRule(K key, K destKey) {
return super._tsDeleteRule(key, destKey)
.replaceWithVoid();
}
@Override
public Uni tsGet(K key) {
return super._tsGet(key)
.map(this::decodeSample);
}
Sample decodeSample(Response response) {
if (response == null || response.size() == 0) {
return null;
}
return new Sample(response.get(0).toLong(), response.get(1).toDouble());
}
@Override
public Uni tsGet(K key, boolean latest) {
return super._tsGet(key, latest)
.map(this::decodeSample);
}
@Override
public Uni tsIncrBy(K key, double value) {
return super._tsIncrBy(key, value)
.replaceWithVoid();
}
@Override
public Uni tsIncrBy(K key, double value, IncrementArgs args) {
return super._tsIncrBy(key, value, args)
.replaceWithVoid();
}
@Override
public Uni tsMAdd(SeriesSample... samples) {
return super._tsMAdd(samples)
.replaceWithVoid();
}
@Override
public Uni
© 2015 - 2025 Weber Informatics LLC | Privacy Policy