Skip to content

Commit

Permalink
Missed several crucial files
Browse files Browse the repository at this point in the history
  • Loading branch information
tishun committed Aug 8, 2024
1 parent 085e792 commit d0ffa50
Show file tree
Hide file tree
Showing 21 changed files with 140 additions and 154 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import io.lettuce.core.output.KeyValueStreamingChannel;
import io.lettuce.core.output.ScoredValueStreamingChannel;
import io.lettuce.core.output.ValueStreamingChannel;
import io.lettuce.core.output.data.DynamicAggregateData;
import io.lettuce.core.protocol.AsyncCommand;
import io.lettuce.core.protocol.Command;
import io.lettuce.core.protocol.CommandArgs;
Expand Down Expand Up @@ -391,7 +390,7 @@ public RedisFuture<String> clientTracking(TrackingArgs args) {
}

@Override
public RedisFuture<DynamicAggregateData> clientTrackinginfo() {
public RedisFuture<TrackingInfo> clientTrackinginfo() {
return dispatch(commandBuilder.clientTrackinginfo());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import io.lettuce.core.output.KeyValueStreamingChannel;
import io.lettuce.core.output.ScoredValueStreamingChannel;
import io.lettuce.core.output.ValueStreamingChannel;
import io.lettuce.core.output.data.DynamicAggregateData;
import io.lettuce.core.protocol.Command;
import io.lettuce.core.protocol.CommandArgs;
import io.lettuce.core.protocol.CommandType;
Expand Down Expand Up @@ -409,7 +408,7 @@ public Mono<String> clientTracking(TrackingArgs args) {
}

@Override
public Mono<DynamicAggregateData> clientTrackinginfo() {
public Mono<TrackingInfo> clientTrackinginfo() {
return createMono(commandBuilder::clientTrackinginfo);
}

Expand Down
5 changes: 2 additions & 3 deletions src/main/java/io/lettuce/core/RedisCommandBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import io.lettuce.core.models.stream.PendingMessage;
import io.lettuce.core.models.stream.PendingMessages;
import io.lettuce.core.output.*;
import io.lettuce.core.output.data.DynamicAggregateData;
import io.lettuce.core.protocol.BaseRedisCommandBuilder;
import io.lettuce.core.protocol.Command;
import io.lettuce.core.protocol.CommandArgs;
Expand Down Expand Up @@ -529,10 +528,10 @@ Command<K, V, String> clientTracking(TrackingArgs trackingArgs) {
return createCommand(CLIENT, new StatusOutput<>(codec), args);
}

Command<K, V, DynamicAggregateData> clientTrackinginfo() {
Command<K, V, TrackingInfo> clientTrackinginfo() {
CommandArgs<K, V> args = new CommandArgs<>(codec).add(TRACKINGINFO);

return new Command<>(CLIENT, new DynamicAggregateOutput<>(codec), args);
return new Command<>(CLIENT, new ComplexOutput<>(codec, TrackingInfoParser.INSTANCE), args);
}

Command<K, V, Long> clientUnblock(long id, UnblockType type) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/lettuce/core/TrackingInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* limitations under the License.
*/

package io.lettuce.core.api.parsers.tracking;
package io.lettuce.core;

import java.util.ArrayList;
import java.util.Collections;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import io.lettuce.core.ShutdownArgs;
import io.lettuce.core.TrackingArgs;
import io.lettuce.core.UnblockType;
import io.lettuce.core.output.data.DynamicAggregateData;
import io.lettuce.core.TrackingInfo;
import io.lettuce.core.protocol.CommandType;

/**
Expand Down Expand Up @@ -181,12 +181,10 @@ public interface RedisServerAsyncCommands<K, V> {
/**
* Returns information about the current client connection's use of the server assisted client side caching feature.
*
* @return {@link DynamicAggregateData}, for more information check the documentation
* @see io.lettuce.core.api.parsers.tracking.TrackingInfoParser
* @see io.lettuce.core.api.parsers.tracking.TrackingInfo
* @since 7.0
* @return {@link TrackingInfo}, for more information check the documentation
* @since 6.5
*/
RedisFuture<DynamicAggregateData> clientTrackinginfo();
RedisFuture<TrackingInfo> clientTrackinginfo();

/**
* Unblock the specified blocked client.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import io.lettuce.core.ShutdownArgs;
import io.lettuce.core.TrackingArgs;
import io.lettuce.core.UnblockType;
import io.lettuce.core.output.data.DynamicAggregateData;
import io.lettuce.core.TrackingInfo;
import io.lettuce.core.protocol.CommandType;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
Expand Down Expand Up @@ -181,12 +181,10 @@ public interface RedisServerReactiveCommands<K, V> {
/**
* Returns information about the current client connection's use of the server assisted client side caching feature.
*
* @return {@link DynamicAggregateData}, for more information check the documentation
* @see io.lettuce.core.api.parsers.tracking.TrackingInfoParser
* @see io.lettuce.core.api.parsers.tracking.TrackingInfo
* @since 7.0
* @return {@link TrackingInfo}, for more information check the documentation
* @since 6.5
*/
Mono<DynamicAggregateData> clientTrackinginfo();
Mono<TrackingInfo> clientTrackinginfo();

/**
* Unblock the specified blocked client.
Expand Down
10 changes: 4 additions & 6 deletions src/main/java/io/lettuce/core/api/sync/RedisServerCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import io.lettuce.core.KillArgs;
import io.lettuce.core.ShutdownArgs;
import io.lettuce.core.TrackingArgs;
import io.lettuce.core.TrackingInfo;
import io.lettuce.core.UnblockType;
import io.lettuce.core.output.data.DynamicAggregateData;
import io.lettuce.core.protocol.CommandType;

/**
Expand Down Expand Up @@ -180,12 +180,10 @@ public interface RedisServerCommands<K, V> {
/**
* Returns information about the current client connection's use of the server assisted client side caching feature.
*
* @return {@link DynamicAggregateData}, for more information check the documentation
* @see io.lettuce.core.api.parsers.tracking.TrackingInfoParser
* @see io.lettuce.core.api.parsers.tracking.TrackingInfo
* @since 7.0
* @return {@link TrackingInfo}, for more information check the documentation
* @since 6.5
*/
DynamicAggregateData clientTrackinginfo();
TrackingInfo clientTrackinginfo();

/**
* Unblock the specified blocked client.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,15 @@
*/
package io.lettuce.core.cluster.api.async;

import java.util.Date;
import java.util.List;
import java.util.Map;

import java.util.List;
import java.util.Date;
import io.lettuce.core.ClientListArgs;
import io.lettuce.core.FlushMode;
import io.lettuce.core.KillArgs;
import io.lettuce.core.TrackingArgs;
import io.lettuce.core.UnblockType;
import io.lettuce.core.output.data.DynamicAggregateData;
import io.lettuce.core.TrackingInfo;
import io.lettuce.core.protocol.CommandType;

/**
Expand Down Expand Up @@ -179,12 +178,10 @@ public interface NodeSelectionServerAsyncCommands<K, V> {
/**
* Returns information about the current client connection's use of the server assisted client side caching feature.
*
* @return {@link DynamicAggregateData}, for more information check the documentation
* @see io.lettuce.core.api.parsers.tracking.TrackingInfoParser
* @see io.lettuce.core.api.parsers.tracking.TrackingInfo
* @since 7.0
* @return {@link TrackingInfo}, for more information check the documentation
* @since 6.5
*/
AsyncExecutions<DynamicAggregateData> clientTrackinginfo();
AsyncExecutions<TrackingInfo> clientTrackinginfo();

/**
* Unblock the specified blocked client.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import io.lettuce.core.KillArgs;
import io.lettuce.core.TrackingArgs;
import io.lettuce.core.UnblockType;
import io.lettuce.core.output.data.DynamicAggregateData;
import io.lettuce.core.TrackingInfo;
import io.lettuce.core.protocol.CommandType;

/**
Expand Down Expand Up @@ -164,7 +164,7 @@ public interface NodeSelectionServerCommands<K, V> {
* @return simple-string-reply {@code OK} if the connection name was successfully set.
* @since 6.3
*/
Executions<String> clientSetinfo(String key, V value);
Executions<String> clientSetinfo(String key, String value);

/**
* Enables the tracking feature of the Redis server, that is used for server assisted client side caching. Tracking messages
Expand All @@ -179,12 +179,10 @@ public interface NodeSelectionServerCommands<K, V> {
/**
* Returns information about the current client connection's use of the server assisted client side caching feature.
*
* @return {@link DynamicAggregateData}, for more information check the documentation
* @see io.lettuce.core.api.parsers.tracking.TrackingInfoParser
* @see io.lettuce.core.api.parsers.tracking.TrackingInfo
* @since 7.0
* @return {@link TrackingInfo}, for more information check the documentation
* @since 6.5
*/
Executions<DynamicAggregateData> clientTrackinginfo();
Executions<TrackingInfo> clientTrackinginfo();

/**
* Unblock the specified blocked client.
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/io/lettuce/core/output/ArrayComplexData.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,25 @@
import java.util.Set;

/**
* An implementation of the {@link DynamicAggregateData} that handles arrays.
* An implementation of the {@link ComplexData} that handles arrays.
* <p>
* For RESP2 calling the {@link DynamicAggregateData#getDynamicMap()} would heuristically go over the list of elements assuming
* every odd element is a key and every even object is the value and then adding them to an {@link Map}. The logic would follow
* the same order that was used when the elements were added to the {@link ArrayAggregateData}. Similarly calling the
* {@link DynamicAggregateData#getDynamicSet()} would return a set of all the elements, adding them in the same order. If - for
* some reason - duplicate elements exist they would be overwritten.
* For RESP2 calling the {@link ComplexData#getDynamicMap()} would heuristically go over the list of elements assuming every odd
* element is a key and every even object is the value and then adding them to an {@link Map}. The logic would follow the same
* order that was used when the elements were added to the {@link ArrayComplexData}. Similarly calling the
* {@link ComplexData#getDynamicSet()} would return a set of all the elements, adding them in the same order. If - for some
* reason - duplicate elements exist they would be overwritten.
* <p>
* All data structures that the implementation returns are unmodifiable
*
* @see DynamicAggregateData
* @see ComplexData
* @author Tihomir Mateev
* @since 6.5
*/
class ArrayAggregateData extends DynamicAggregateData {
class ArrayComplexData extends ComplexData {

private final List<Object> data;

public ArrayAggregateData(int count) {
public ArrayComplexData(int count) {
data = new ArrayList<>(count);
}

Expand Down
38 changes: 18 additions & 20 deletions src/main/java/io/lettuce/core/output/ComplexData.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,16 @@
import java.util.Set;

/**
* The base type of all aggregate data, collected by a {@link io.lettuce.core.output.DynamicAggregateOutput}
* The base type of all complex data, collected by a {@link ComplexOutput}
* <p>
* Commands typically result in simple types, however some of the commands could return complex nested structures. A simple
* solution to parse such a structure is to have a dynamic data type and leave the user to parse the result to a domain object.
* If there is some breach of contract then the code consuming the driver could simply stop using the provided parser and start
* parsing the new dynamic data itself, without having to change the version of the library. This allows a certain degree of
* stability against change. Consult the members of the {@link io.lettuce.core.api.parsers} package for details on how aggregate
* Objects could be parsed.
* Commands typically result in simple types, however some of the commands could return complex nested structures. In these
* cases, and with the help of a {@link ComplexDataParser}, the data gathered by the {@link ComplexOutput} could be parsed to a
* domain object.
* <p>
* An aggregate data object could contain multiple (or no) units of simple data, as per the
* An complex data object could only be an aggregate data type as per the
* <a href="https://github.com/redis/redis-specifications/blob/master/protocol/RESP2.md">RESP2</a> and
* <a href="https://github.com/redis/redis-specifications/blob/master/protocol/RESP3.md">RESP3</a> protocol definitions.
* <a href="https://github.com/redis/redis-specifications/blob/master/protocol/RESP3.md">RESP3</a> protocol definitions. Its
* contents, however, could be both the simple and aggregate data types.
* <p>
* For RESP2 the only possible aggregation is an array. RESP2 commands could also return sets (obviously, by simply making sure
* the elements of the array are unique) or maps (by sending the keys as odd elements and their values as even elements in the
Expand All @@ -45,21 +43,21 @@
* For RESP3 all the three aggregate types are supported (and indicated with special characters when the result is returned by
* the server).
* <p>
* Aggregate data types could also be nested by using the {@link DynamicAggregateData#storeObject(Object)} call.
* Aggregate data types could also be nested by using the {@link ComplexData#storeObject(Object)} call.
* <p>
* Implementations of this class override the {@link DynamicAggregateData#getDynamicSet()},
* {@link DynamicAggregateData#getDynamicList()} and {@link DynamicAggregateData#getDynamicMap()} methods to return the data
* received in the server in a implementation of the Collections framework. If a given implementation could not do the
* conversion in a meaningful way an {@link UnsupportedOperationException} would be thrown.
* Implementations of this class override the {@link ComplexData#getDynamicSet()}, {@link ComplexData#getDynamicList()} and
* {@link ComplexData#getDynamicMap()} methods to return the data received in the server in a implementation of the Collections
* framework. If a given implementation could not do the conversion in a meaningful way an {@link UnsupportedOperationException}
* would be thrown.
*
* @see io.lettuce.core.output.DynamicAggregateOutput
* @see ArrayAggregateData
* @see SetAggregateData
* @see MapAggregateData
* @see ComplexOutput
* @see ArrayComplexData
* @see SetComplexData
* @see MapComplexData
* @author Tihomir Mateev
* @since 6.5
*/
public abstract class DynamicAggregateData {
public abstract class ComplexData {

/**
* Store a <code>long</code> value in the underlying data structure
Expand Down Expand Up @@ -90,7 +88,7 @@ public void store(boolean value) {

/**
* Store an {@link Object} value in the underlying data structure. This method should be used when nesting one instance of
* {@link DynamicAggregateData} inside another
* {@link ComplexData} inside another
*
* @param value the value to store
*/
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/io/lettuce/core/output/ComplexDataParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@
package io.lettuce.core.output;

/**
* Any usage of the {@link DynamicAggregateOutput} comes hand in hand with a respective {@link DynamicAggregateDataParser} that
* is able to parse the data extracted from the server to a meaningful Java object.
* Any usage of the {@link ComplexOutput} comes hand in hand with a respective {@link ComplexDataParser} that is able to parse
* the data extracted from the server to a meaningful Java object.
*
* @param <T> the type of the parsed object
* @author Tihomir Mateev
* @see DynamicAggregateData
* @see DynamicAggregateOutput
* @see ComplexData
* @see ComplexOutput
* @since 6.5
*/
public interface DynamicAggregateDataParser<T> {
public interface ComplexDataParser<T> {

/**
* Parse the data extracted from the server to a specific domain object.
Expand All @@ -39,6 +39,6 @@ public interface DynamicAggregateDataParser<T> {
* @return the parsed object
* @since 6.5
*/
T parse(DynamicAggregateData data);
T parse(ComplexData data);

}
Loading

0 comments on commit d0ffa50

Please sign in to comment.