Merge branch 'master' into 3.0.0
# Conflicts: # redisson/src/main/java/org/redisson/reactive/RedissonObjectReactive.java # redisson/src/main/java/org/redisson/reactive/RedissonScoredSortedSetReactive.javapull/1821/head
commit
776d89dc3e
@ -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,144 @@
|
|||||||
|
/**
|
||||||
|
* 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.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import org.reactivestreams.Publisher;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Nikita Koksharov
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface RRateLimiterReactive extends RObjectReactive {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes RateLimiter's state and stores config to Redis server.
|
||||||
|
*
|
||||||
|
* @param mode - rate mode
|
||||||
|
* @param rate - rate
|
||||||
|
* @param rateInterval - rate time interval
|
||||||
|
* @param rateIntervalUnit - rate time interval unit
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Publisher<Boolean> trySetRate(RateType mode, long rate, long rateInterval, RateIntervalUnit rateIntervalUnit);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Acquires a permit only if one is available at the
|
||||||
|
* time of invocation.
|
||||||
|
*
|
||||||
|
* <p>Acquires a permit, if one is available and returns immediately,
|
||||||
|
* with the value {@code true},
|
||||||
|
* reducing the number of available permits by one.
|
||||||
|
*
|
||||||
|
* <p>If no permit is available then this method will return
|
||||||
|
* immediately with the value {@code false}.
|
||||||
|
*
|
||||||
|
* @return {@code true} if a permit was acquired and {@code false}
|
||||||
|
* otherwise
|
||||||
|
*/
|
||||||
|
Publisher<Boolean> tryAcquire();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Acquires the given number of <code>permits</code> only if all are available at the
|
||||||
|
* time of invocation.
|
||||||
|
*
|
||||||
|
* <p>Acquires a permits, if all are available and returns immediately,
|
||||||
|
* with the value {@code true},
|
||||||
|
* reducing the number of available permits by given number of permits.
|
||||||
|
*
|
||||||
|
* <p>If no permits are available then this method will return
|
||||||
|
* immediately with the value {@code false}.
|
||||||
|
*
|
||||||
|
* @param permits the number of permits to acquire
|
||||||
|
* @return {@code true} if a permit was acquired and {@code false}
|
||||||
|
* otherwise
|
||||||
|
*/
|
||||||
|
Publisher<Boolean> tryAcquire(long permits);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Acquires a permit from this RateLimiter, blocking until one is available.
|
||||||
|
*
|
||||||
|
* <p>Acquires a permit, if one is available and returns immediately,
|
||||||
|
* reducing the number of available permits by one.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
Publisher<Void> acquire();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Acquires a specified <code>permits</code> from this RateLimiter,
|
||||||
|
* blocking until one is available.
|
||||||
|
*
|
||||||
|
* <p>Acquires the given number of permits, if they are available
|
||||||
|
* and returns immediately, reducing the number of available permits
|
||||||
|
* by the given amount.
|
||||||
|
*
|
||||||
|
* @param permits
|
||||||
|
*/
|
||||||
|
Publisher<Void> acquire(long permits);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Acquires a permit from this RateLimiter, if one becomes available
|
||||||
|
* within the given waiting time.
|
||||||
|
*
|
||||||
|
* <p>Acquires a permit, if one is available and returns immediately,
|
||||||
|
* with the value {@code true},
|
||||||
|
* reducing the number of available permits by one.
|
||||||
|
*
|
||||||
|
* <p>If no permit is available then the current thread becomes
|
||||||
|
* disabled for thread scheduling purposes and lies dormant until
|
||||||
|
* specified waiting time elapses.
|
||||||
|
*
|
||||||
|
* <p>If a permit is acquired then the value {@code true} is returned.
|
||||||
|
*
|
||||||
|
* <p>If the specified waiting time elapses then the value {@code false}
|
||||||
|
* is returned. If the time is less than or equal to zero, the method
|
||||||
|
* will not wait at all.
|
||||||
|
*
|
||||||
|
* @param timeout the maximum time to wait for a permit
|
||||||
|
* @param unit the time unit of the {@code timeout} argument
|
||||||
|
* @return {@code true} if a permit was acquired and {@code false}
|
||||||
|
* if the waiting time elapsed before a permit was acquired
|
||||||
|
*/
|
||||||
|
Publisher<Boolean> tryAcquire(long timeout, TimeUnit unit);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Acquires the given number of <code>permits</code> only if all are available
|
||||||
|
* within the given waiting time.
|
||||||
|
*
|
||||||
|
* <p>Acquires the given number of permits, if all are available and returns immediately,
|
||||||
|
* with the value {@code true}, reducing the number of available permits by one.
|
||||||
|
*
|
||||||
|
* <p>If no permit is available then the current thread becomes
|
||||||
|
* disabled for thread scheduling purposes and lies dormant until
|
||||||
|
* the specified waiting time elapses.
|
||||||
|
*
|
||||||
|
* <p>If a permits is acquired then the value {@code true} is returned.
|
||||||
|
*
|
||||||
|
* <p>If the specified waiting time elapses then the value {@code false}
|
||||||
|
* is returned. If the time is less than or equal to zero, the method
|
||||||
|
* will not wait at all.
|
||||||
|
*
|
||||||
|
* @param permits amount
|
||||||
|
* @param timeout the maximum time to wait for a permit
|
||||||
|
* @param unit the time unit of the {@code timeout} argument
|
||||||
|
* @return {@code true} if a permit was acquired and {@code false}
|
||||||
|
* if the waiting time elapsed before a permit was acquired
|
||||||
|
*/
|
||||||
|
Publisher<Boolean> tryAcquire(long permits, long timeout, TimeUnit unit);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,159 @@
|
|||||||
|
/**
|
||||||
|
* 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.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.reactivestreams.Publisher;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Nikita Koksharov
|
||||||
|
*
|
||||||
|
* @param <V> object type
|
||||||
|
*/
|
||||||
|
public interface RSortableReactive<V> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read data in sorted view
|
||||||
|
*
|
||||||
|
* @param order for sorted data
|
||||||
|
* @return sorted collection
|
||||||
|
*/
|
||||||
|
Publisher<V> readSorted(SortOrder order);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read data in sorted view
|
||||||
|
*
|
||||||
|
* @param order for sorted data
|
||||||
|
* @param offset of sorted data
|
||||||
|
* @param count of sorted data
|
||||||
|
* @return sorted collection
|
||||||
|
*/
|
||||||
|
Publisher<V> readSorted(SortOrder order, int offset, int count);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read data in sorted view
|
||||||
|
*
|
||||||
|
* @param byPattern that is used to generate the keys that are used for sorting
|
||||||
|
* @param order for sorted data
|
||||||
|
* @return sorted collection
|
||||||
|
*/
|
||||||
|
Publisher<V> readSorted(String byPattern, SortOrder order);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read data in sorted view
|
||||||
|
*
|
||||||
|
* @param byPattern that is used to generate the keys that are used for sorting
|
||||||
|
* @param order for sorted data
|
||||||
|
* @param offset of sorted data
|
||||||
|
* @param count of sorted data
|
||||||
|
* @return sorted collection
|
||||||
|
*/
|
||||||
|
Publisher<V> readSorted(String byPattern, SortOrder order, int offset, int count);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read data in sorted view
|
||||||
|
*
|
||||||
|
* @param <T> object type
|
||||||
|
* @param byPattern that is used to generate the keys that are used for sorting
|
||||||
|
* @param getPatterns that is used to load values by keys in sorted view
|
||||||
|
* @param order for sorted data
|
||||||
|
* @return sorted collection
|
||||||
|
*/
|
||||||
|
<T> Publisher<Collection<T>> readSorted(String byPattern, List<String> getPatterns, SortOrder order);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read data in sorted view
|
||||||
|
*
|
||||||
|
* @param <T> object type
|
||||||
|
* @param byPattern that is used to generate the keys that are used for sorting
|
||||||
|
* @param getPatterns that is used to load values by keys in sorted view
|
||||||
|
* @param order for sorted data
|
||||||
|
* @param offset of sorted data
|
||||||
|
* @param count of sorted data
|
||||||
|
* @return sorted collection
|
||||||
|
*/
|
||||||
|
<T> Publisher<Collection<T>> readSorted(String byPattern, List<String> getPatterns, SortOrder order, int offset, int count);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort data and store to <code>destName</code> list
|
||||||
|
*
|
||||||
|
* @param destName list object destination
|
||||||
|
* @param order for sorted data
|
||||||
|
* @return length of sorted data
|
||||||
|
*/
|
||||||
|
Publisher<Integer> sortTo(String destName, SortOrder order);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort data and store to <code>destName</code> list
|
||||||
|
*
|
||||||
|
* @param destName list object destination
|
||||||
|
* @param order for sorted data
|
||||||
|
* @param offset of sorted data
|
||||||
|
* @param count of sorted data
|
||||||
|
* @return length of sorted data
|
||||||
|
*/
|
||||||
|
Publisher<Integer> sortTo(String destName, SortOrder order, int offset, int count);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort data and store to <code>destName</code> list
|
||||||
|
*
|
||||||
|
* @param destName list object destination
|
||||||
|
* @param byPattern that is used to generate the keys that are used for sorting
|
||||||
|
* @param order for sorted data
|
||||||
|
* @return length of sorted data
|
||||||
|
*/
|
||||||
|
Publisher<Integer> sortTo(String destName, String byPattern, SortOrder order);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort data and store to <code>destName</code> list
|
||||||
|
*
|
||||||
|
* @param destName list object destination
|
||||||
|
* @param byPattern that is used to generate the keys that are used for sorting
|
||||||
|
* @param order for sorted data
|
||||||
|
* @param offset of sorted data
|
||||||
|
* @param count of sorted data
|
||||||
|
* @return length of sorted data
|
||||||
|
*/
|
||||||
|
Publisher<Integer> sortTo(String destName, String byPattern, SortOrder order, int offset, int count);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort data and store to <code>destName</code> list
|
||||||
|
*
|
||||||
|
* @param destName list object destination
|
||||||
|
* @param byPattern that is used to generate the keys that are used for sorting
|
||||||
|
* @param getPatterns that is used to load values by keys in sorted view
|
||||||
|
* @param order for sorted data
|
||||||
|
* @return length of sorted data
|
||||||
|
*/
|
||||||
|
Publisher<Integer> sortTo(String destName, String byPattern, List<String> getPatterns, SortOrder order);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort data and store to <code>destName</code> list
|
||||||
|
*
|
||||||
|
* @param destName list object destination
|
||||||
|
* @param byPattern that is used to generate the keys that are used for sorting
|
||||||
|
* @param getPatterns that is used to load values by keys in sorted view
|
||||||
|
* @param order for sorted data
|
||||||
|
* @param offset of sorted data
|
||||||
|
* @param count of sorted data
|
||||||
|
* @return length of sorted data
|
||||||
|
*/
|
||||||
|
Publisher<Integer> sortTo(String destName, String byPattern, List<String> getPatterns, SortOrder order, int offset, int count);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,430 @@
|
|||||||
|
/**
|
||||||
|
* 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 java.util.function.Supplier;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @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);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,119 @@
|
|||||||
|
/**
|
||||||
|
* 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.concurrent.TimeUnit;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
import org.reactivestreams.Publisher;
|
||||||
|
import org.redisson.RedissonRateLimiter;
|
||||||
|
import org.redisson.api.RFuture;
|
||||||
|
import org.redisson.api.RRateLimiterAsync;
|
||||||
|
import org.redisson.api.RRateLimiterReactive;
|
||||||
|
import org.redisson.api.RateIntervalUnit;
|
||||||
|
import org.redisson.api.RateType;
|
||||||
|
import org.redisson.command.CommandReactiveExecutor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Nikita Koksharov
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class RedissonRateLimiterReactive extends RedissonObjectReactive implements RRateLimiterReactive {
|
||||||
|
|
||||||
|
private final RRateLimiterAsync instance;
|
||||||
|
|
||||||
|
public RedissonRateLimiterReactive(CommandReactiveExecutor connectionManager, String name) {
|
||||||
|
this(connectionManager, name, new RedissonRateLimiter(connectionManager, name));
|
||||||
|
}
|
||||||
|
|
||||||
|
private RedissonRateLimiterReactive(CommandReactiveExecutor connectionManager, String name, RRateLimiterAsync instance) {
|
||||||
|
super(connectionManager, name, instance);
|
||||||
|
this.instance = instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Publisher<Boolean> trySetRate(final RateType mode, final long rate, final long rateInterval,
|
||||||
|
final RateIntervalUnit rateIntervalUnit) {
|
||||||
|
return reactive(new Supplier<RFuture<Boolean>>() {
|
||||||
|
@Override
|
||||||
|
public RFuture<Boolean> get() {
|
||||||
|
return instance.trySetRateAsync(mode, rate, rateInterval, rateIntervalUnit);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Publisher<Boolean> tryAcquire() {
|
||||||
|
return reactive(new Supplier<RFuture<Boolean>>() {
|
||||||
|
@Override
|
||||||
|
public RFuture<Boolean> get() {
|
||||||
|
return instance.tryAcquireAsync();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Publisher<Boolean> tryAcquire(final long permits) {
|
||||||
|
return reactive(new Supplier<RFuture<Boolean>>() {
|
||||||
|
@Override
|
||||||
|
public RFuture<Boolean> get() {
|
||||||
|
return instance.tryAcquireAsync(permits);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Publisher<Void> acquire() {
|
||||||
|
return reactive(new Supplier<RFuture<Void>>() {
|
||||||
|
@Override
|
||||||
|
public RFuture<Void> get() {
|
||||||
|
return instance.acquireAsync();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Publisher<Void> acquire(final long permits) {
|
||||||
|
return reactive(new Supplier<RFuture<Void>>() {
|
||||||
|
@Override
|
||||||
|
public RFuture<Void> get() {
|
||||||
|
return instance.acquireAsync(permits);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Publisher<Boolean> tryAcquire(final long timeout, final TimeUnit unit) {
|
||||||
|
return reactive(new Supplier<RFuture<Boolean>>() {
|
||||||
|
@Override
|
||||||
|
public RFuture<Boolean> get() {
|
||||||
|
return instance.tryAcquireAsync(timeout, unit);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Publisher<Boolean> tryAcquire(final long permits, final long timeout, final TimeUnit unit) {
|
||||||
|
return reactive(new Supplier<RFuture<Boolean>>() {
|
||||||
|
@Override
|
||||||
|
public RFuture<Boolean> get() {
|
||||||
|
return instance.tryAcquireAsync(permits, timeout, unit);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue