Skip to content

Commit eb3ad1e

Browse files
DATAREDIS-659 - Polishing.
Update JavaDoc and assert nullability contract. Use slowlog-max-len in tests instead of maxclients avoiding potential ulimit errors. Original Pull Request: spring-projects#253
1 parent 4c88fe1 commit eb3ad1e

11 files changed

+377
-145
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ build
1515
out
1616
work
1717
*.rdb
18+
*.aof

src/main/java/org/springframework/data/redis/connection/ReactiveClusterServerCommands.java

+73-12
Original file line numberDiff line numberDiff line change
@@ -23,102 +23,163 @@
2323
import org.springframework.data.redis.core.types.RedisClientInfo;
2424

2525
/**
26+
* Redis Server commands executed in cluster environment using reactive infrastructure.
27+
*
2628
* @author Mark Paluch
29+
* @author Christoph Strobl
2730
* @since 2.0
2831
*/
2932
public interface ReactiveClusterServerCommands extends ReactiveServerCommands {
3033

3134
/**
35+
* Start an {@literal Append Only File} rewrite process on the specific server.
36+
*
3237
* @param node must not be {@literal null}.
38+
* @return {@link Mono} indicating command completion.
39+
* @throws IllegalArgumentException when {@code node} is {@literal null}.
3340
* @see RedisServerCommands#bgReWriteAof()
3441
*/
3542
Mono<String> bgReWriteAof(RedisClusterNode node);
3643

3744
/**
45+
* Start background saving of db on server.
46+
*
3847
* @param node must not be {@literal null}.
48+
* @return {@link Mono} indicating command received by server. Operation success needs to be checked via
49+
* {@link #lastSave(RedisClusterNode)}.
50+
* @throws IllegalArgumentException when {@code node} is {@literal null}.
3951
* @see RedisServerCommands#bgSave()
4052
*/
4153
Mono<String> bgSave(RedisClusterNode node);
4254

4355
/**
56+
* Get time unix timestamp of last successful {@link #bgSave()} operation in seconds.
57+
*
4458
* @param node must not be {@literal null}.
45-
* @return
59+
* @return @return {@link Mono} wrapping unix timestamp.
60+
* @throws IllegalArgumentException when {@code node} is {@literal null}.
4661
* @see RedisServerCommands#lastSave()
4762
*/
4863
Mono<Long> lastSave(RedisClusterNode node);
4964

5065
/**
66+
* Synchronous save current db snapshot on server.
67+
*
5168
* @param node must not be {@literal null}.
69+
* @return {@link Mono} indicating command completion.
70+
* @throws IllegalArgumentException when {@code node} is {@literal null}.
5271
* @see RedisServerCommands#save()
5372
*/
5473
Mono<String> save(RedisClusterNode node);
5574

5675
/**
76+
* Get the total number of available keys in currently selected database.
77+
*
5778
* @param node must not be {@literal null}.
58-
* @return
79+
* @return {@link Mono} wrapping number of keys.
80+
* @throws IllegalArgumentException when {@code node} is {@literal null}.
5981
* @see RedisServerCommands#dbSize()
6082
*/
6183
Mono<Long> dbSize(RedisClusterNode node);
6284

6385
/**
64-
* @param node must not be {@literal null}.
86+
* Delete all keys of the currently selected database.
87+
*
88+
* @param node must not be {@literal null}. {@link Mono} indicating command completion.
89+
* @throws IllegalArgumentException when {@code node} is {@literal null}.
6590
* @see RedisServerCommands#flushDb()
6691
*/
6792
Mono<String> flushDb(RedisClusterNode node);
6893

6994
/**
95+
* Delete all <b>all keys</b> from <b>all databases</b>.
96+
*
7097
* @param node must not be {@literal null}.
98+
* @return {@link Mono} indicating command completion.
99+
* @throws IllegalArgumentException when {@code node} is {@literal null}.
71100
* @see RedisServerCommands#flushAll()
72101
*/
73102
Mono<String> flushAll(RedisClusterNode node);
74103

75104
/**
105+
* Load {@literal default} server information like
106+
* <ul>
107+
* <li>memory</li>
108+
* <li>cpu utilization</li>
109+
* <li>replication</li>
110+
* </ul>
111+
* <p>
112+
*
76113
* @param node must not be {@literal null}.
77-
* @return
114+
* @return {@link Mono} wrapping server information.
115+
* @throws IllegalArgumentException when {@code node} is {@literal null}.
78116
* @see RedisServerCommands#info()
79117
*/
80118
Mono<Properties> info(RedisClusterNode node);
81119

82120
/**
121+
* Load server information for given {@code selection}.
122+
*
83123
* @param node must not be {@literal null}.
84-
* @param section
85-
* @return
124+
* @param section must not be {@literal null} nor {@literal empty}.
125+
* @return {@link Mono} wrapping server information of given {@code section}.
126+
* @throws IllegalArgumentException when {@code node} is {@literal null}.
127+
* @throws IllegalArgumentException when section is {@literal null} or {@literal empty}.
86128
* @see RedisServerCommands#info(String)
87129
*/
88130
Mono<Properties> info(RedisClusterNode node, String section);
89131

90132
/**
133+
* Load configuration parameters for given {@code pattern} from server.
134+
*
91135
* @param node must not be {@literal null}.
92-
* @param pattern
93-
* @return
136+
* @param pattern must not be {@literal null}.
137+
* @return {@link Mono} wrapping configuration parameters matching given {@code pattern}.
138+
* @throws IllegalArgumentException when {@code node} is {@literal null}.
139+
* @throws IllegalArgumentException when {@code pattern} is {@literal null} or {@literal empty}.
94140
* @see RedisServerCommands#getConfig(String)
95141
*/
96142
Mono<Properties> getConfig(RedisClusterNode node, String pattern);
97143

98144
/**
145+
* Set server configuration for {@code param} to {@code value}.
146+
*
99147
* @param node must not be {@literal null}.
100-
* @param param
101-
* @param value
148+
* @param param must not be {@literal null} nor {@literal empty}.
149+
* @param value must not be {@literal null} nor {@literal empty}.
150+
* @throws IllegalArgumentException when {@code node} is {@literal null}.
151+
* @throws IllegalArgumentException when {@code pattern} / {@code value} is {@literal null} or {@literal empty}.
102152
* @see RedisServerCommands#setConfig(String, String)
103153
*/
104154
Mono<String> setConfig(RedisClusterNode node, String param, String value);
105155

106156
/**
157+
* Reset statistic counters on server. <br>
158+
* Counters can be retrieved using {@link #info()}.
159+
*
107160
* @param node must not be {@literal null}.
161+
* @return {@link Mono} indicating command completion.
162+
* @throws IllegalArgumentException when {@code node} is {@literal null}.
108163
* @see RedisServerCommands#resetConfigStats()
109164
*/
110165
Mono<String> resetConfigStats(RedisClusterNode node);
111166

112167
/**
168+
* Request server timestamp using {@code TIME} command.
169+
*
113170
* @param node must not be {@literal null}.
114-
* @return
171+
* @return {@link Mono} wrapping current server time in milliseconds.
172+
* @throws IllegalArgumentException when {@code node} is {@literal null}.
115173
* @see RedisServerCommands#time()
116174
*/
117175
Mono<Long> time(RedisClusterNode node);
118176

119177
/**
178+
* Request information and statistics about connected clients.
179+
*
120180
* @param node must not be {@literal null}.
121-
* @return
181+
* @return {@link Flux} emitting {@link RedisClientInfo} objects.
182+
* @throws IllegalArgumentException when {@code node} is {@literal null}.
122183
* @see RedisServerCommands#getClientList()
123184
*/
124185
Flux<RedisClientInfo> getClientList(RedisClusterNode node);

src/main/java/org/springframework/data/redis/connection/ReactiveRedisClusterConnection.java

+10-7
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@
2424
*/
2525
public interface ReactiveRedisClusterConnection extends ReactiveRedisConnection {
2626

27-
/**
28-
* @param node must not be {@literal null}.
29-
* @return
30-
* @see RedisConnectionCommands#ping()
31-
*/
32-
Mono<String> ping(RedisClusterNode node);
33-
3427
@Override
3528
ReactiveClusterKeyCommands keyCommands();
3629

@@ -60,4 +53,14 @@ public interface ReactiveRedisClusterConnection extends ReactiveRedisConnection
6053

6154
@Override
6255
ReactiveClusterServerCommands serverCommands();
56+
57+
/**
58+
* Test the connection to a specific Redis cluster node.
59+
*
60+
* @param node must not be {@literal null}.
61+
* @return {@link Mono} wrapping server response message - usually {@literal PONG}.
62+
* @throws IllegalArgumentException when {@code node} is {@literal null}.
63+
* @see RedisConnectionCommands#ping()
64+
*/
65+
Mono<String> ping(RedisClusterNode node);
6366
}

src/main/java/org/springframework/data/redis/connection/ReactiveRedisConnection.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public interface ReactiveRedisConnection extends Closeable {
9797
/**
9898
* Get {@link ReactiveHashCommands}.
9999
*
100-
* @return
100+
* @return never {@literal null}.
101101
*/
102102
ReactiveHashCommands hashCommands();
103103

@@ -125,7 +125,7 @@ public interface ReactiveRedisConnection extends Closeable {
125125
/**
126126
* Test connection.
127127
*
128-
* @return Server response message - usually {@literal PONG}.
128+
* @return {@link Mono} wrapping server response message - usually {@literal PONG}.
129129
* @see <a href="http://redis.io/commands/ping">Redis Documentation: PING</a>
130130
*/
131131
Mono<String> ping();

0 commit comments

Comments
 (0)