Added RGeoReactive. #1555
parent
4a7f63051c
commit
14aad8e0e0
@ -0,0 +1,549 @@
|
||||
/**
|
||||
* Copyright 2018 Nikita Koksharov
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.redisson.api;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.reactivestreams.Publisher;
|
||||
|
||||
/**
|
||||
* Geospatial items holder.
|
||||
*
|
||||
* @author Nikita Koksharov
|
||||
*
|
||||
* @param <V> type of value
|
||||
*/
|
||||
public interface RGeoReactive<V> extends RScoredSortedSetReactive<V> {
|
||||
|
||||
/**
|
||||
* Adds geospatial member.
|
||||
*
|
||||
* @param longitude - longitude of object
|
||||
* @param latitude - latitude of object
|
||||
* @param member - object itself
|
||||
* @return number of elements added to the sorted set,
|
||||
* not including elements already existing for which
|
||||
* the score was updated
|
||||
*/
|
||||
Publisher<Long> add(double longitude, double latitude, V member);
|
||||
|
||||
/**
|
||||
* Adds geospatial members.
|
||||
*
|
||||
* @param entries - objects
|
||||
* @return number of elements added to the sorted set,
|
||||
* not including elements already existing for which
|
||||
* the score was updated
|
||||
*/
|
||||
Publisher<Long> add(GeoEntry... entries);
|
||||
|
||||
/**
|
||||
* Returns distance between members in <code>GeoUnit</code> units.
|
||||
*
|
||||
* @param firstMember - first object
|
||||
* @param secondMember - second object
|
||||
* @param geoUnit - geo unit
|
||||
* @return distance
|
||||
*/
|
||||
Publisher<Double> dist(V firstMember, V secondMember, GeoUnit geoUnit);
|
||||
|
||||
/**
|
||||
* Returns 11 characters Geohash string mapped by defined member.
|
||||
*
|
||||
* @param members - objects
|
||||
* @return hash mapped by object
|
||||
*/
|
||||
Publisher<Map<V, String>> hash(V... members);
|
||||
|
||||
/**
|
||||
* Returns geo-position mapped by defined member.
|
||||
*
|
||||
* @param members - objects
|
||||
* @return geo position mapped by object
|
||||
*/
|
||||
Publisher<Map<V, GeoPosition>> pos(V... members);
|
||||
|
||||
/**
|
||||
* Returns the members of a sorted set, which are within the
|
||||
* borders of the area specified with the center location
|
||||
* and the maximum distance from the center (the radius)
|
||||
* in <code>GeoUnit</code> units.
|
||||
*
|
||||
* @param longitude - longitude of object
|
||||
* @param latitude - latitude of object
|
||||
* @param radius - radius in geo units
|
||||
* @param geoUnit - geo unit
|
||||
* @return list of objects
|
||||
*/
|
||||
Publisher<List<V>> radius(double longitude, double latitude, double radius, GeoUnit geoUnit);
|
||||
|
||||
/**
|
||||
* Returns the members of a sorted set, which are within the
|
||||
* borders of the area specified with the center location
|
||||
* and the maximum distance from the center (the radius)
|
||||
* in <code>GeoUnit</code> units and limited by count
|
||||
*
|
||||
* @param longitude - longitude of object
|
||||
* @param latitude - latitude of object
|
||||
* @param radius - radius in geo units
|
||||
* @param geoUnit - geo unit
|
||||
* @param count - result limit
|
||||
* @return list of objects
|
||||
*/
|
||||
Publisher<List<V>> radius(double longitude, double latitude, double radius, GeoUnit geoUnit, int count);
|
||||
|
||||
/**
|
||||
* Returns the members of a sorted set, which are within the
|
||||
* borders of the area specified with the center location
|
||||
* and the maximum distance from the center (the radius)
|
||||
* in <code>GeoUnit</code> units with <code>GeoOrder</code>
|
||||
*
|
||||
* @param longitude - longitude of object
|
||||
* @param latitude - latitude of object
|
||||
* @param radius - radius in geo units
|
||||
* @param geoUnit - geo unit
|
||||
* @param geoOrder - order of result
|
||||
* @return list of objects
|
||||
*/
|
||||
Publisher<List<V>> radius(double longitude, double latitude, double radius, GeoUnit geoUnit, GeoOrder geoOrder);
|
||||
|
||||
/**
|
||||
* Returns the members of a sorted set, which are within the
|
||||
* borders of the area specified with the center location
|
||||
* and the maximum distance from the center (the radius)
|
||||
* in <code>GeoUnit</code> units with <code>GeoOrder</code>
|
||||
* and limited by count
|
||||
*
|
||||
* @param longitude - longitude of object
|
||||
* @param latitude - latitude of object
|
||||
* @param radius - radius in geo units
|
||||
* @param geoUnit - geo unit
|
||||
* @param geoOrder - order of result
|
||||
* @param count - result limit
|
||||
* @return list of objects
|
||||
*/
|
||||
Publisher<List<V>> radius(double longitude, double latitude, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count);
|
||||
|
||||
/**
|
||||
* Returns the distance mapped by member, distance between member and the location.
|
||||
* Members of a sorted set, which are within the
|
||||
* borders of the area specified with the center location
|
||||
* and the maximum distance from the center (the radius)
|
||||
* in <code>GeoUnit</code> units.
|
||||
*
|
||||
* @param longitude - longitude of object
|
||||
* @param latitude - latitude of object
|
||||
* @param radius - radius in geo units
|
||||
* @param geoUnit - geo unit
|
||||
* @return distance mapped by object
|
||||
*/
|
||||
Publisher<Map<V, Double>> radiusWithDistance(double longitude, double latitude, double radius, GeoUnit geoUnit);
|
||||
|
||||
/**
|
||||
* Returns the distance mapped by member, distance between member and the location.
|
||||
* Members of a sorted set, which are within the
|
||||
* borders of the area specified with the center location
|
||||
* and the maximum distance from the center (the radius)
|
||||
* in <code>GeoUnit</code> units and limited by count.
|
||||
*
|
||||
* @param longitude - longitude of object
|
||||
* @param latitude - latitude of object
|
||||
* @param radius - radius in geo units
|
||||
* @param geoUnit - geo unit
|
||||
* @param count - result limit
|
||||
* @return distance mapped by object
|
||||
*/
|
||||
Publisher<Map<V, Double>> radiusWithDistance(double longitude, double latitude, double radius, GeoUnit geoUnit, int count);
|
||||
|
||||
/**
|
||||
* Returns the distance mapped by member, distance between member and the location.
|
||||
* Members of a sorted set, which are within the
|
||||
* borders of the area specified with the center location
|
||||
* and the maximum distance from the center (the radius)
|
||||
* in <code>GeoUnit</code> units with <code>GeoOrder</code>
|
||||
*
|
||||
* @param longitude - longitude of object
|
||||
* @param latitude - latitude of object
|
||||
* @param radius - radius in geo units
|
||||
* @param geoUnit - geo unit
|
||||
* @param geoOrder - order of result
|
||||
* @return distance mapped by object
|
||||
*/
|
||||
Publisher<Map<V, Double>> radiusWithDistance(double longitude, double latitude, double radius, GeoUnit geoUnit, GeoOrder geoOrder);
|
||||
|
||||
/**
|
||||
* Returns the distance mapped by member, distance between member and the location.
|
||||
* Members of a sorted set, which are within the
|
||||
* borders of the area specified with the center location
|
||||
* and the maximum distance from the center (the radius)
|
||||
* in <code>GeoUnit</code> units with <code>GeoOrder</code>
|
||||
* and limited by count
|
||||
*
|
||||
* @param longitude - longitude of object
|
||||
* @param latitude - latitude of object
|
||||
* @param radius - radius in geo units
|
||||
* @param geoUnit - geo unit
|
||||
* @param geoOrder - order of result
|
||||
* @param count - result limit
|
||||
* @return distance mapped by object
|
||||
*/
|
||||
Publisher<Map<V, Double>> radiusWithDistance(double longitude, double latitude, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count);
|
||||
|
||||
/**
|
||||
* Returns the geo-position mapped by member.
|
||||
* Members of a sorted set, which are within the
|
||||
* borders of the area specified with the center location
|
||||
* and the maximum distance from the center (the radius)
|
||||
* in <code>GeoUnit</code> units.
|
||||
*
|
||||
* @param longitude - longitude of object
|
||||
* @param latitude - latitude of object
|
||||
* @param radius - radius in geo units
|
||||
* @param geoUnit - geo unit
|
||||
* @return geo position mapped by object
|
||||
*/
|
||||
Publisher<Map<V, GeoPosition>> radiusWithPosition(double longitude, double latitude, double radius, GeoUnit geoUnit);
|
||||
|
||||
/**
|
||||
* Returns the geo-position mapped by member.
|
||||
* Members of a sorted set, which are within the
|
||||
* borders of the area specified with the center location
|
||||
* and the maximum distance from the center (the radius)
|
||||
* in <code>GeoUnit</code> units and limited by count
|
||||
*
|
||||
* @param longitude - longitude of object
|
||||
* @param latitude - latitude of object
|
||||
* @param radius - radius in geo units
|
||||
* @param geoUnit - geo unit
|
||||
* @param count - result limit
|
||||
* @return geo position mapped by object
|
||||
*/
|
||||
Publisher<Map<V, GeoPosition>> radiusWithPosition(double longitude, double latitude, double radius, GeoUnit geoUnit, int count);
|
||||
|
||||
/**
|
||||
* Returns the geo-position mapped by member.
|
||||
* Members of a sorted set, which are within the
|
||||
* borders of the area specified with the center location
|
||||
* and the maximum distance from the center (the radius)
|
||||
* in <code>GeoUnit</code> units with <code>GeoOrder</code>
|
||||
*
|
||||
* @param longitude - longitude of object
|
||||
* @param latitude - latitude of object
|
||||
* @param radius - radius in geo units
|
||||
* @param geoUnit - geo unit
|
||||
* @param geoOrder - geo order
|
||||
* @return geo position mapped by object
|
||||
*/
|
||||
Publisher<Map<V, GeoPosition>> radiusWithPosition(double longitude, double latitude, double radius, GeoUnit geoUnit, GeoOrder geoOrder);
|
||||
|
||||
/**
|
||||
* Returns the geo-position mapped by member.
|
||||
* Members of a sorted set, which are within the
|
||||
* borders of the area specified with the center location
|
||||
* and the maximum distance from the center (the radius)
|
||||
* in <code>GeoUnit</code> units with <code>GeoOrder</code>
|
||||
* and limited by count
|
||||
*
|
||||
* @param longitude - longitude of object
|
||||
* @param latitude - latitude of object
|
||||
* @param radius - radius in geo units
|
||||
* @param geoUnit - geo unit
|
||||
* @param geoOrder - geo order
|
||||
* @param count - result limit
|
||||
* @return geo position mapped by object
|
||||
*/
|
||||
Publisher<Map<V, GeoPosition>> radiusWithPosition(double longitude, double latitude, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count);
|
||||
|
||||
/**
|
||||
* Returns the members of a sorted set, which are within the
|
||||
* borders of the area specified with the defined member location
|
||||
* and the maximum distance from the defined member location (the radius)
|
||||
* in <code>GeoUnit</code> units.
|
||||
*
|
||||
* @param member - object
|
||||
* @param radius - radius in geo units
|
||||
* @param geoUnit - geo unit
|
||||
* @return list of objects
|
||||
*/
|
||||
Publisher<List<V>> radius(V member, double radius, GeoUnit geoUnit);
|
||||
|
||||
/**
|
||||
* Returns the members of a sorted set, which are within the
|
||||
* borders of the area specified with the defined member location
|
||||
* and the maximum distance from the defined member location (the radius)
|
||||
* in <code>GeoUnit</code> units and limited by count
|
||||
*
|
||||
* @param member - object
|
||||
* @param radius - radius in geo units
|
||||
* @param geoUnit - geo unit
|
||||
* @param count - result limit
|
||||
* @return list of objects
|
||||
*/
|
||||
Publisher<List<V>> radius(V member, double radius, GeoUnit geoUnit, int count);
|
||||
|
||||
/**
|
||||
* Returns the members of a sorted set, which are within the
|
||||
* borders of the area specified with the defined member location
|
||||
* and the maximum distance from the defined member location (the radius)
|
||||
* in <code>GeoUnit</code> units with <code>GeoOrder</code>
|
||||
*
|
||||
* @param member - object
|
||||
* @param radius - radius in geo units
|
||||
* @param geoUnit - geo unit
|
||||
* @param geoOrder - geo order
|
||||
* @return list of objects
|
||||
*/
|
||||
Publisher<List<V>> radius(V member, double radius, GeoUnit geoUnit, GeoOrder geoOrder);
|
||||
|
||||
/**
|
||||
* Returns the members of a sorted set, which are within the
|
||||
* borders of the area specified with the defined member location
|
||||
* and the maximum distance from the defined member location (the radius)
|
||||
* in <code>GeoUnit</code> units with <code>GeoOrder</code>
|
||||
*
|
||||
* @param member - object
|
||||
* @param radius - radius in geo units
|
||||
* @param geoUnit - geo unit
|
||||
* @param geoOrder - geo order
|
||||
* @param count - result limit
|
||||
* @return list of objects
|
||||
*/
|
||||
Publisher<List<V>> radius(V member, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count);
|
||||
|
||||
/**
|
||||
* Returns the distance mapped by member, distance between member and the defined member location.
|
||||
* Members of a sorted set, which are within the
|
||||
* borders of the area specified with the defined member location
|
||||
* and the maximum distance from the defined member location (the radius)
|
||||
* in <code>GeoUnit</code> units.
|
||||
*
|
||||
* @param member - object
|
||||
* @param radius - radius in geo units
|
||||
* @param geoUnit - geo unit
|
||||
* @return distance mapped by object
|
||||
*/
|
||||
Publisher<Map<V, Double>> radiusWithDistance(V member, double radius, GeoUnit geoUnit);
|
||||
|
||||
/**
|
||||
* Returns the distance mapped by member, distance between member and the defined member location.
|
||||
* Members of a sorted set, which are within the
|
||||
* borders of the area specified with the defined member location
|
||||
* and the maximum distance from the defined member location (the radius)
|
||||
* in <code>GeoUnit</code> units and limited by count
|
||||
*
|
||||
* @param member - object
|
||||
* @param radius - radius in geo units
|
||||
* @param geoUnit - geo unit
|
||||
* @param count - result limit
|
||||
* @return distance mapped by object
|
||||
*/
|
||||
Publisher<Map<V, Double>> radiusWithDistance(V member, double radius, GeoUnit geoUnit, int count);
|
||||
|
||||
/**
|
||||
* Returns the distance mapped by member, distance between member and the defined member location.
|
||||
* Members of a sorted set, which are within the
|
||||
* borders of the area specified with the defined member location
|
||||
* and the maximum distance from the defined member location (the radius)
|
||||
* in <code>GeoUnit</code> units with <code>GeoOrder</code>
|
||||
*
|
||||
* @param member - object
|
||||
* @param radius - radius in geo units
|
||||
* @param geoUnit - geo unit
|
||||
* @param geoOrder - geo
|
||||
* @return distance mapped by object
|
||||
*/
|
||||
Publisher<Map<V, Double>> radiusWithDistance(V member, double radius, GeoUnit geoUnit, GeoOrder geoOrder);
|
||||
|
||||
/**
|
||||
* Returns the distance mapped by member, distance between member and the defined member location.
|
||||
* Members of a sorted set, which are within the
|
||||
* borders of the area specified with the defined member location
|
||||
* and the maximum distance from the defined member location (the radius)
|
||||
* in <code>GeoUnit</code> units with <code>GeoOrder</code>
|
||||
* and limited by count
|
||||
*
|
||||
* @param member - object
|
||||
* @param radius - radius in geo units
|
||||
* @param geoUnit - geo unit
|
||||
* @param geoOrder - geo
|
||||
* @param count - result limit
|
||||
* @return distance mapped by object
|
||||
*/
|
||||
Publisher<Map<V, Double>> radiusWithDistance(V member, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count);
|
||||
|
||||
/**
|
||||
* Returns the geo-position mapped by member.
|
||||
* Members of a sorted set, which are within the
|
||||
* borders of the area specified with the defined member location
|
||||
* and the maximum distance from the defined member location (the radius)
|
||||
* in <code>GeoUnit</code> units.
|
||||
*
|
||||
* @param member - object
|
||||
* @param radius - radius in geo units
|
||||
* @param geoUnit - geo unit
|
||||
* @return geo position mapped by object
|
||||
*/
|
||||
Publisher<Map<V, GeoPosition>> radiusWithPosition(V member, double radius, GeoUnit geoUnit);
|
||||
|
||||
/**
|
||||
* Returns the geo-position mapped by member.
|
||||
* Members of a sorted set, which are within the
|
||||
* borders of the area specified with the defined member location
|
||||
* and the maximum distance from the defined member location (the radius)
|
||||
* in <code>GeoUnit</code> units and limited by count
|
||||
*
|
||||
* @param member - object
|
||||
* @param radius - radius in geo units
|
||||
* @param geoUnit - geo unit
|
||||
* @param count - result limit
|
||||
* @return geo position mapped by object
|
||||
*/
|
||||
Publisher<Map<V, GeoPosition>> radiusWithPosition(V member, double radius, GeoUnit geoUnit, int count);
|
||||
|
||||
/**
|
||||
* Returns the geo-position mapped by member.
|
||||
* Members of a sorted set, which are within the
|
||||
* borders of the area specified with the defined member location
|
||||
* and the maximum distance from the defined member location (the radius)
|
||||
* in <code>GeoUnit</code> units with <code>GeoOrder</code>
|
||||
*
|
||||
* @param member - object
|
||||
* @param radius - radius in geo units
|
||||
* @param geoUnit - geo unit
|
||||
* @param geoOrder - geo order
|
||||
* @return geo position mapped by object
|
||||
*/
|
||||
Publisher<Map<V, GeoPosition>> radiusWithPosition(V member, double radius, GeoUnit geoUnit, GeoOrder geoOrder);
|
||||
|
||||
/**
|
||||
* Returns the geo-position mapped by member.
|
||||
* Members of a sorted set, which are within the
|
||||
* borders of the area specified with the defined member location
|
||||
* and the maximum distance from the defined member location (the radius)
|
||||
* in <code>GeoUnit</code> units with <code>GeoOrder</code>
|
||||
* and limited by count
|
||||
*
|
||||
* @param member - object
|
||||
* @param radius - radius in geo units
|
||||
* @param geoUnit - geo unit
|
||||
* @param geoOrder - geo order
|
||||
* @param count - result limit
|
||||
* @return geo position mapped by object
|
||||
*/
|
||||
Publisher<Map<V, GeoPosition>> radiusWithPosition(V member, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count);
|
||||
|
||||
/**
|
||||
* Finds the members of a sorted set, which are within the
|
||||
* borders of the area specified with the center location
|
||||
* and the maximum distance from the center (the radius)
|
||||
* in <code>GeoUnit</code> units.
|
||||
* Store result to <code>destName</code>.
|
||||
*
|
||||
* @param destName - Geo object destination
|
||||
* @param longitude - longitude of object
|
||||
* @param latitude - latitude of object
|
||||
* @param radius - radius in geo units
|
||||
* @param geoUnit - geo unit
|
||||
* @return length of result
|
||||
*/
|
||||
Publisher<Long> radiusStoreTo(String destName, double longitude, double latitude, double radius, GeoUnit geoUnit);
|
||||
|
||||
/**
|
||||
* Finds the members of a sorted set, which are within the
|
||||
* borders of the area specified with the center location
|
||||
* and the maximum distance from the center (the radius)
|
||||
* in <code>GeoUnit</code> units and limited by count
|
||||
* Store result to <code>destName</code>.
|
||||
*
|
||||
* @param destName - Geo object destination
|
||||
* @param longitude - longitude of object
|
||||
* @param latitude - latitude of object
|
||||
* @param radius - radius in geo units
|
||||
* @param geoUnit - geo unit
|
||||
* @param count - result limit
|
||||
* @return length of result
|
||||
*/
|
||||
Publisher<Long> radiusStoreTo(String destName, double longitude, double latitude, double radius, GeoUnit geoUnit, int count);
|
||||
|
||||
/**
|
||||
* Finds the members of a sorted set, which are within the
|
||||
* borders of the area specified with the center location
|
||||
* and the maximum distance from the center (the radius)
|
||||
* in <code>GeoUnit</code> units with <code>GeoOrder</code>
|
||||
* and limited by count
|
||||
* Store result to <code>destName</code>.
|
||||
*
|
||||
* @param destName - Geo object destination
|
||||
* @param longitude - longitude of object
|
||||
* @param latitude - latitude of object
|
||||
* @param radius - radius in geo units
|
||||
* @param geoUnit - geo unit
|
||||
* @param geoOrder - order of result
|
||||
* @param count - result limit
|
||||
* @return length of result
|
||||
*/
|
||||
Publisher<Long> radiusStoreTo(String destName, double longitude, double latitude, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count);
|
||||
|
||||
/**
|
||||
* Finds the members of a sorted set, which are within the
|
||||
* borders of the area specified with the defined member location
|
||||
* and the maximum distance from the defined member location (the radius)
|
||||
* in <code>GeoUnit</code> units.
|
||||
* Store result to <code>destName</code>.
|
||||
*
|
||||
* @param destName - Geo object destination
|
||||
* @param member - object
|
||||
* @param radius - radius in geo units
|
||||
* @param geoUnit - geo unit
|
||||
* @return length of result
|
||||
*/
|
||||
Publisher<Long> radiusStoreTo(String destName, V member, double radius, GeoUnit geoUnit);
|
||||
|
||||
/**
|
||||
* Finds the members of a sorted set, which are within the
|
||||
* borders of the area specified with the defined member location
|
||||
* and the maximum distance from the defined member location (the radius)
|
||||
* in <code>GeoUnit</code> units and limited by count
|
||||
* Store result to <code>destName</code>.
|
||||
*
|
||||
* @param destName - Geo object destination
|
||||
* @param member - object
|
||||
* @param radius - radius in geo units
|
||||
* @param geoUnit - geo unit
|
||||
* @param count - result limit
|
||||
* @return length of result
|
||||
*/
|
||||
Publisher<Long> radiusStoreTo(String destName, V member, double radius, GeoUnit geoUnit, int count);
|
||||
|
||||
/**
|
||||
* Finds the members of a sorted set, which are within the
|
||||
* borders of the area specified with the defined member location
|
||||
* and the maximum distance from the defined member location (the radius)
|
||||
* in <code>GeoUnit</code> units with <code>GeoOrder</code>
|
||||
* Store result to <code>destName</code>.
|
||||
*
|
||||
* @param destName - Geo object destination
|
||||
* @param member - object
|
||||
* @param radius - radius in geo units
|
||||
* @param geoUnit - geo unit
|
||||
* @param geoOrder - geo order
|
||||
* @param count - result limit
|
||||
* @return length of result
|
||||
*/
|
||||
Publisher<Long> radiusStoreTo(String destName, V member, double radius, GeoUnit geoUnit, GeoOrder geoOrder, int count);
|
||||
|
||||
}
|
@ -0,0 +1,431 @@
|
||||
/**
|
||||
* Copyright 2018 Nikita Koksharov
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.redisson.reactive;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.reactivestreams.Publisher;
|
||||
import org.redisson.RedissonGeo;
|
||||
import org.redisson.api.GeoEntry;
|
||||
import org.redisson.api.GeoOrder;
|
||||
import org.redisson.api.GeoPosition;
|
||||
import org.redisson.api.GeoUnit;
|
||||
import org.redisson.api.RFuture;
|
||||
import org.redisson.api.RGeoAsync;
|
||||
import org.redisson.api.RGeoReactive;
|
||||
import org.redisson.client.codec.Codec;
|
||||
import org.redisson.command.CommandReactiveExecutor;
|
||||
|
||||
import reactor.fn.Supplier;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Nikita Koksharov
|
||||
*
|
||||
* @param <V> value type
|
||||
*/
|
||||
public class RedissonGeoReactive<V> extends RedissonScoredSortedSetReactive<V> implements RGeoReactive<V> {
|
||||
|
||||
private final RGeoAsync<V> instance;
|
||||
|
||||
public RedissonGeoReactive(CommandReactiveExecutor commandExecutor, String name) {
|
||||
this(commandExecutor, name, new RedissonGeo<V>(commandExecutor, name, null));
|
||||
}
|
||||
|
||||
public RedissonGeoReactive(CommandReactiveExecutor commandExecutor, String name, RGeoAsync<V> instance) {
|
||||
super(commandExecutor, name, instance);
|
||||
this.instance = instance;
|
||||
}
|
||||
|
||||
public RedissonGeoReactive(Codec codec, CommandReactiveExecutor commandExecutor, String name) {
|
||||
this(codec, commandExecutor, name, new RedissonGeo<V>(codec, commandExecutor, name, null));
|
||||
}
|
||||
|
||||
public RedissonGeoReactive(Codec codec, CommandReactiveExecutor commandExecutor, String name, RGeoAsync<V> instance) {
|
||||
super(codec, commandExecutor, name, instance);
|
||||
this.instance = instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Long> add(final double longitude, final double latitude, final V member) {
|
||||
return reactive(new Supplier<RFuture<Long>>() {
|
||||
@Override
|
||||
public RFuture<Long> get() {
|
||||
return instance.addAsync(longitude, latitude, member);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Long> add(final GeoEntry... entries) {
|
||||
return reactive(new Supplier<RFuture<Long>>() {
|
||||
@Override
|
||||
public RFuture<Long> get() {
|
||||
return instance.addAsync(entries);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Double> dist(final V firstMember, final V secondMember, final GeoUnit geoUnit) {
|
||||
return reactive(new Supplier<RFuture<Double>>() {
|
||||
@Override
|
||||
public RFuture<Double> get() {
|
||||
return instance.distAsync(firstMember, secondMember, geoUnit);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<V, String>> hash(final V... members) {
|
||||
return reactive(new Supplier<RFuture<Map<V, String>>>() {
|
||||
@Override
|
||||
public RFuture<Map<V, String>> get() {
|
||||
return instance.hashAsync(members);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<V, GeoPosition>> pos(final V... members) {
|
||||
return reactive(new Supplier<RFuture<Map<V, GeoPosition>>>() {
|
||||
@Override
|
||||
public RFuture<Map<V, GeoPosition>> get() {
|
||||
return instance.posAsync(members);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<List<V>> radius(final double longitude, final double latitude, final double radius, final GeoUnit geoUnit) {
|
||||
return reactive(new Supplier<RFuture<List<V>>>() {
|
||||
@Override
|
||||
public RFuture<List<V>> get() {
|
||||
return instance.radiusAsync(longitude, latitude, radius, geoUnit);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<List<V>> radius(final double longitude, final double latitude, final double radius, final GeoUnit geoUnit, final int count) {
|
||||
return reactive(new Supplier<RFuture<List<V>>>() {
|
||||
@Override
|
||||
public RFuture<List<V>> get() {
|
||||
return instance.radiusAsync(longitude, latitude, radius, geoUnit, count);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<List<V>> radius(final double longitude, final double latitude, final double radius, final GeoUnit geoUnit,
|
||||
final GeoOrder geoOrder) {
|
||||
return reactive(new Supplier<RFuture<List<V>>>() {
|
||||
@Override
|
||||
public RFuture<List<V>> get() {
|
||||
return instance.radiusAsync(longitude, latitude, radius, geoUnit, geoOrder);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<List<V>> radius(final double longitude, final double latitude, final double radius, final GeoUnit geoUnit,
|
||||
final GeoOrder geoOrder, final int count) {
|
||||
return reactive(new Supplier<RFuture<List<V>>>() {
|
||||
@Override
|
||||
public RFuture<List<V>> get() {
|
||||
return instance.radiusAsync(longitude, latitude, radius, geoUnit, geoOrder, count);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<V, Double>> radiusWithDistance(final double longitude, final double latitude, final double radius,
|
||||
final GeoUnit geoUnit) {
|
||||
return reactive(new Supplier<RFuture<Map<V, Double>>>() {
|
||||
@Override
|
||||
public RFuture<Map<V, Double>> get() {
|
||||
return instance.radiusWithDistanceAsync(longitude, latitude, radius, geoUnit);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<V, Double>> radiusWithDistance(final double longitude, final double latitude, final double radius,
|
||||
final GeoUnit geoUnit, final int count) {
|
||||
return reactive(new Supplier<RFuture<Map<V, Double>>>() {
|
||||
@Override
|
||||
public RFuture<Map<V, Double>> get() {
|
||||
return instance.radiusWithDistanceAsync(longitude, latitude, radius, geoUnit, count);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<V, Double>> radiusWithDistance(final double longitude, final double latitude, final double radius,
|
||||
final GeoUnit geoUnit, final GeoOrder geoOrder) {
|
||||
return reactive(new Supplier<RFuture<Map<V, Double>>>() {
|
||||
@Override
|
||||
public RFuture<Map<V, Double>> get() {
|
||||
return instance.radiusWithDistanceAsync(longitude, latitude, radius, geoUnit, geoOrder);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<V, Double>> radiusWithDistance(final double longitude, final double latitude, final double radius,
|
||||
final GeoUnit geoUnit, final GeoOrder geoOrder, final int count) {
|
||||
return reactive(new Supplier<RFuture<Map<V, Double>>>() {
|
||||
@Override
|
||||
public RFuture<Map<V, Double>> get() {
|
||||
return instance.radiusWithDistanceAsync(longitude, latitude, radius, geoUnit, geoOrder, count);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<V, GeoPosition>> radiusWithPosition(final double longitude, final double latitude, final double radius,
|
||||
final GeoUnit geoUnit) {
|
||||
return reactive(new Supplier<RFuture<Map<V, GeoPosition>>>() {
|
||||
@Override
|
||||
public RFuture<Map<V, GeoPosition>> get() {
|
||||
return instance.radiusWithPositionAsync(longitude, latitude, radius, geoUnit);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<V, GeoPosition>> radiusWithPosition(final double longitude, final double latitude, final double radius,
|
||||
final GeoUnit geoUnit, final int count) {
|
||||
return reactive(new Supplier<RFuture<Map<V, GeoPosition>>>() {
|
||||
@Override
|
||||
public RFuture<Map<V, GeoPosition>> get() {
|
||||
return instance.radiusWithPositionAsync(longitude, latitude, radius, geoUnit, count);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<V, GeoPosition>> radiusWithPosition(final double longitude, final double latitude, final double radius,
|
||||
final GeoUnit geoUnit, final GeoOrder geoOrder) {
|
||||
return reactive(new Supplier<RFuture<Map<V, GeoPosition>>>() {
|
||||
@Override
|
||||
public RFuture<Map<V, GeoPosition>> get() {
|
||||
return instance.radiusWithPositionAsync(longitude, latitude, radius, geoUnit, geoOrder);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<V, GeoPosition>> radiusWithPosition(final double longitude, final double latitude, final double radius,
|
||||
final GeoUnit geoUnit, final GeoOrder geoOrder, final int count) {
|
||||
return reactive(new Supplier<RFuture<Map<V, GeoPosition>>>() {
|
||||
@Override
|
||||
public RFuture<Map<V, GeoPosition>> get() {
|
||||
return instance.radiusWithPositionAsync(longitude, latitude, radius, geoUnit, geoOrder, count);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<List<V>> radius(final V member, final double radius, final GeoUnit geoUnit) {
|
||||
return reactive(new Supplier<RFuture<List<V>>>() {
|
||||
@Override
|
||||
public RFuture<List<V>> get() {
|
||||
return instance.radiusAsync(member, radius, geoUnit);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<List<V>> radius(final V member, final double radius, final GeoUnit geoUnit, final int count) {
|
||||
return reactive(new Supplier<RFuture<List<V>>>() {
|
||||
@Override
|
||||
public RFuture<List<V>> get() {
|
||||
return instance.radiusAsync(member, radius, geoUnit, count);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<List<V>> radius(final V member, final double radius, final GeoUnit geoUnit, final GeoOrder geoOrder) {
|
||||
return reactive(new Supplier<RFuture<List<V>>>() {
|
||||
@Override
|
||||
public RFuture<List<V>> get() {
|
||||
return instance.radiusAsync(member, radius, geoUnit, geoOrder);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<List<V>> radius(final V member, final double radius, final GeoUnit geoUnit, final GeoOrder geoOrder, final int count) {
|
||||
return reactive(new Supplier<RFuture<List<V>>>() {
|
||||
@Override
|
||||
public RFuture<List<V>> get() {
|
||||
return instance.radiusAsync(member, radius, geoUnit, geoOrder, count);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<V, Double>> radiusWithDistance(final V member, final double radius, final GeoUnit geoUnit) {
|
||||
return reactive(new Supplier<RFuture<Map<V, Double>>>() {
|
||||
@Override
|
||||
public RFuture<Map<V, Double>> get() {
|
||||
return instance.radiusWithDistanceAsync(member, radius, geoUnit);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<V, Double>> radiusWithDistance(final V member, final double radius, final GeoUnit geoUnit, final int count) {
|
||||
return reactive(new Supplier<RFuture<Map<V, Double>>>() {
|
||||
@Override
|
||||
public RFuture<Map<V, Double>> get() {
|
||||
return instance.radiusWithDistanceAsync(member, radius, geoUnit, count);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<V, Double>> radiusWithDistance(final V member, final double radius, final GeoUnit geoUnit, final GeoOrder geoOrder) {
|
||||
return reactive(new Supplier<RFuture<Map<V, Double>>>() {
|
||||
@Override
|
||||
public RFuture<Map<V, Double>> get() {
|
||||
return instance.radiusWithDistanceAsync(member, radius, geoUnit, geoOrder);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<V, Double>> radiusWithDistance(final V member, final double radius, final GeoUnit geoUnit, final GeoOrder geoOrder,
|
||||
final int count) {
|
||||
return reactive(new Supplier<RFuture<Map<V, Double>>>() {
|
||||
@Override
|
||||
public RFuture<Map<V, Double>> get() {
|
||||
return instance.radiusWithDistanceAsync(member, radius, geoUnit, geoOrder, count);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<V, GeoPosition>> radiusWithPosition(final V member, final double radius, final GeoUnit geoUnit) {
|
||||
return reactive(new Supplier<RFuture<Map<V, GeoPosition>>>() {
|
||||
@Override
|
||||
public RFuture<Map<V, GeoPosition>> get() {
|
||||
return instance.radiusWithPositionAsync(member, radius, geoUnit);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<V, GeoPosition>> radiusWithPosition(final V member, final double radius, final GeoUnit geoUnit, final int count) {
|
||||
return reactive(new Supplier<RFuture<Map<V, GeoPosition>>>() {
|
||||
@Override
|
||||
public RFuture<Map<V, GeoPosition>> get() {
|
||||
return instance.radiusWithPositionAsync(member, radius, geoUnit, count);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<V, GeoPosition>> radiusWithPosition(final V member, final double radius, final GeoUnit geoUnit,
|
||||
final GeoOrder geoOrder) {
|
||||
return reactive(new Supplier<RFuture<Map<V, GeoPosition>>>() {
|
||||
@Override
|
||||
public RFuture<Map<V, GeoPosition>> get() {
|
||||
return instance.radiusWithPositionAsync(member, radius, geoUnit, geoOrder);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Map<V, GeoPosition>> radiusWithPosition(final V member, final double radius, final GeoUnit geoUnit,
|
||||
final GeoOrder geoOrder, final int count) {
|
||||
return reactive(new Supplier<RFuture<Map<V, GeoPosition>>>() {
|
||||
@Override
|
||||
public RFuture<Map<V, GeoPosition>> get() {
|
||||
return instance.radiusWithPositionAsync(member, radius, geoUnit, geoOrder, count);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Long> radiusStoreTo(final String destName, final double longitude, final double latitude, final double radius,
|
||||
final GeoUnit geoUnit) {
|
||||
return reactive(new Supplier<RFuture<Long>>() {
|
||||
@Override
|
||||
public RFuture<Long> get() {
|
||||
return instance.radiusStoreToAsync(destName, longitude, latitude, radius, geoUnit);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Long> radiusStoreTo(final String destName, final double longitude, final double latitude, final double radius,
|
||||
final GeoUnit geoUnit, final int count) {
|
||||
return reactive(new Supplier<RFuture<Long>>() {
|
||||
@Override
|
||||
public RFuture<Long> get() {
|
||||
return instance.radiusStoreToAsync(destName, longitude, latitude, radius, geoUnit, count);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Long> radiusStoreTo(final String destName, final double longitude, final double latitude, final double radius,
|
||||
final GeoUnit geoUnit, final GeoOrder geoOrder, final int count) {
|
||||
return reactive(new Supplier<RFuture<Long>>() {
|
||||
@Override
|
||||
public RFuture<Long> get() {
|
||||
return instance.radiusStoreToAsync(destName, longitude, latitude, radius, geoUnit, geoOrder, count);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Long> radiusStoreTo(final String destName, final V member, final double radius, final GeoUnit geoUnit) {
|
||||
return reactive(new Supplier<RFuture<Long>>() {
|
||||
@Override
|
||||
public RFuture<Long> get() {
|
||||
return instance.radiusStoreToAsync(destName, member, radius, geoUnit);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Long> radiusStoreTo(final String destName, final V member, final double radius, final GeoUnit geoUnit, final int count) {
|
||||
return reactive(new Supplier<RFuture<Long>>() {
|
||||
@Override
|
||||
public RFuture<Long> get() {
|
||||
return instance.radiusStoreToAsync(destName, member, radius, geoUnit, count);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Publisher<Long> radiusStoreTo(final String destName, final V member, final double radius, final GeoUnit geoUnit, final GeoOrder geoOrder,
|
||||
final int count) {
|
||||
return reactive(new Supplier<RFuture<Long>>() {
|
||||
@Override
|
||||
public RFuture<Long> get() {
|
||||
return instance.radiusStoreToAsync(destName, member, radius, geoUnit, geoOrder, count);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue