DATAREDIS-624 - Upgrade to Reactor 3.1.0.BUILD-SNAPSHOT.

Translate `Mono.then` -> `flatMap`, `Mono.flatMap` -> `flatMapMany`.
This still fails as we also need a compatible version of lettuce.

Original pull request: #245.
This commit is contained in:
Christoph Strobl
2017-04-12 08:58:41 +02:00
committed by Mark Paluch
parent 04e3465081
commit 2c14460643
8 changed files with 24 additions and 31 deletions

View File

@@ -417,7 +417,7 @@ public interface ReactiveGeoCommands {
Assert.notNull(member, "Member must not be null!");
return geoHash(key, Collections.singletonList(member)) //
.then(vals -> vals.isEmpty() ? Mono.empty() : Mono.justOrEmpty(vals.iterator().next()));
.flatMap(vals -> vals.isEmpty() ? Mono.empty() : Mono.justOrEmpty(vals.iterator().next()));
}
/**
@@ -524,7 +524,7 @@ public interface ReactiveGeoCommands {
Assert.notNull(member, "Member must not be null!");
return geoPos(key, Collections.singletonList(member))
.then(vals -> vals.isEmpty() ? Mono.empty() : Mono.justOrEmpty(vals.iterator().next()));
.flatMap(vals -> vals.isEmpty() ? Mono.empty() : Mono.justOrEmpty(vals.iterator().next()));
}
/**

View File

@@ -88,7 +88,7 @@ public class LettuceReactiveClusterKeyCommands extends LettuceReactiveKeyCommand
return super.rename(Mono.just(command));
}
Flux<Boolean> result = cmd.dump(command.getKey())
Mono<Boolean> result = cmd.dump(command.getKey())
.otherwiseIfEmpty(Mono.error(new RedisSystemException("Cannot rename key that does not exist",
new RedisException("ERR no such key."))))
.flatMap(value -> cmd.restore(command.getNewName(), 0, value).flatMap(res -> cmd.del(command.getKey())))
@@ -114,7 +114,7 @@ public class LettuceReactiveClusterKeyCommands extends LettuceReactiveKeyCommand
return super.renameNX(Mono.just(command));
}
Flux<Boolean> result = cmd.exists(command.getNewName()).flatMap(exists -> {
Mono<Boolean> result = cmd.exists(command.getNewName()).flatMap(exists -> {
if (exists == 1) {
return Mono.just(Boolean.FALSE);

View File

@@ -78,7 +78,7 @@ public class LettuceReactiveClusterListCommands extends LettuceReactiveListComma
return super.rPopLPush(Mono.just(command));
}
Flux<ByteBuffer> result = cmd.rpop(command.getKey())
Mono<ByteBuffer> result = cmd.rpop(command.getKey())
.flatMap(value -> cmd.lpush(command.getDestination(), value).map(x -> value));
return result.map(value -> new ByteBufferResponse<>(command, value));

View File

@@ -224,7 +224,7 @@ public class LettuceReactiveClusterSetCommands extends LettuceReactiveSetCommand
return super.sMove(Mono.just(command));
}
Flux<Boolean> result = cmd.exists(command.getKey())
Mono<Boolean> result = cmd.exists(command.getKey())
.flatMap(nrKeys -> nrKeys == 0 ? Mono.empty() : cmd.sismember(command.getKey(), command.getValue()))
.flatMap(exists -> {

View File

@@ -240,7 +240,7 @@ public class DefaultReactiveGeoOperations<K, V> implements ReactiveGeoOperations
Assert.notNull(within, "Circle must not be null!");
return createMono(connection -> connection.geoRadius(rawKey(key), within) //
.flatMap(Flux::fromIterable) //
.flatMapMany(Flux::fromIterable) //
.map(location -> new GeoLocation<>(readValue(location.getName()), location.getPoint())) //
.collectList());
}
@@ -256,7 +256,7 @@ public class DefaultReactiveGeoOperations<K, V> implements ReactiveGeoOperations
Assert.notNull(args, "GeoRadiusCommandArgs must not be null!");
return createMono(connection -> connection.geoRadius(rawKey(key), within, args) //
.flatMap(Flux::fromIterable) //
.flatMapMany(Flux::fromIterable) //
.map(geoResult -> new GeoResult<>(
new GeoLocation<>(readValue(geoResult.getContent().getName()), geoResult.getContent().getPoint()),
geoResult.getDistance())) //
@@ -274,7 +274,7 @@ public class DefaultReactiveGeoOperations<K, V> implements ReactiveGeoOperations
Assert.notNull(member, "Member must not be null!");
return createMono(connection -> connection.geoRadiusByMember(rawKey(key), rawValue(member), new Distance(radius)) //
.flatMap(Flux::fromIterable) //
.flatMapMany(Flux::fromIterable) //
.map(geoLocation -> new GeoLocation<>(readValue(geoLocation.getName()), geoLocation.getPoint())) //
.collectList());
}
@@ -290,7 +290,7 @@ public class DefaultReactiveGeoOperations<K, V> implements ReactiveGeoOperations
Assert.notNull(distance, "Distance must not be null!");
return createMono(connection -> connection.geoRadiusByMember(rawKey(key), rawValue(member), distance) //
.flatMap(Flux::fromIterable) //
.flatMapMany(Flux::fromIterable) //
.map(geoLocation -> new GeoLocation<>(readValue(geoLocation.getName()), geoLocation.getPoint())) //
.collectList());
}
@@ -308,7 +308,7 @@ public class DefaultReactiveGeoOperations<K, V> implements ReactiveGeoOperations
Assert.notNull(args, "GeoRadiusCommandArgs must not be null!");
return createMono(connection -> connection.geoRadiusByMember(rawKey(key), rawValue(member), distance, args) //
.flatMap(Flux::fromIterable) //
.flatMapMany(Flux::fromIterable) //
.map(geoResult -> new GeoResult<>(
new GeoLocation<>(readValue(geoResult.getContent().getName()), geoResult.getContent().getPoint()),
geoResult.getDistance())) //

View File

@@ -74,7 +74,7 @@ public class DefaultReactiveHashOperations<H, HK, HV> implements ReactiveHashOpe
return createMono(connection -> Flux.fromArray(hashKeys) //
.map(o -> (HK) o).map(this::rawHashKey) //
.collectList() //
.then(hks -> connection.hDel(rawKey(key), hks)));
.flatMap(hks -> connection.hDel(rawKey(key), hks)));
}
/* (non-Javadoc)
@@ -116,7 +116,7 @@ public class DefaultReactiveHashOperations<H, HK, HV> implements ReactiveHashOpe
return createMono(connection -> Flux.fromIterable(hashKeys) //
.map(this::rawHashKey) //
.collectList() //
.then(hks -> connection.hMGet(rawKey(key), hks)).map(this::deserializeHashValues));
.flatMap(hks -> connection.hMGet(rawKey(key), hks)).map(this::deserializeHashValues));
}
/* (non-Javadoc)
@@ -156,7 +156,7 @@ public class DefaultReactiveHashOperations<H, HK, HV> implements ReactiveHashOpe
Assert.notNull(key, "Key must not be null!");
return createMono(connection -> connection.hKeys(rawKey(key)) //
.flatMap(Flux::fromIterable) //
.flatMapMany(Flux::fromIterable) //
.map(this::readHashKey) //
.collectList());
}
@@ -221,7 +221,7 @@ public class DefaultReactiveHashOperations<H, HK, HV> implements ReactiveHashOpe
Assert.notNull(key, "Key must not be null!");
return createMono(connection -> connection.hVals(rawKey(key)) //
.flatMap(Flux::fromIterable) //
.flatMapMany(Flux::fromIterable) //
.map(this::readHashValue) //
.collectList());
}