Skip to content

Commit 9cb4db8

Browse files
committed
Polishing.
This commit performs the following polishing changes: - remove manual not null check in `TrimOptions.<init>` as it's already `@NullMarked` - annotate `RedisStreamCommands.XDelOptions` with `@NullMarked` - remove usage of `var` in main code - use since `4.1` instead of `4.0` - rename pendingReferences to deletionPolicy - use ParameterizedTest for StreamConvertersUnitTest - simplify test to not verify things it does not do - fix formatting in various classes - minor tweak to javadocs - inline converters in Lettuce StreamConverters Original pull request #3247 See #3232 Signed-off-by: Chris Bono <chris.bono@broadcom.com>
1 parent 278f278 commit 9cb4db8

13 files changed

+236
-359
lines changed

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

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ public AddStreamRecord approximateTrimming(boolean approximateTrimming) {
312312
*
313313
* @param options the {@link XAddOptions} to apply. Must not be {@literal null}.
314314
* @return a new {@link AddStreamRecord} with the specified options applied.
315-
* @since 4.0
315+
* @since 4.1
316316
*/
317317
public AddStreamRecord withOptions(XAddOptions options) {
318318
return new AddStreamRecord(record, options);
@@ -379,7 +379,7 @@ public boolean hasMinId() {
379379

380380
/**
381381
* @return the XAddOptions options.
382-
* @since 4.0
382+
* @since 4.1
383383
*/
384384
public XAddOptions getOptions() {
385385
return options;
@@ -618,7 +618,7 @@ public List<RecordId> getRecordIds() {
618618
* {@code XDELEX} command parameters.
619619
*
620620
* @author Viktoriya Kutsarova
621-
* @since 4.0
621+
* @since 4.1
622622
* @see <a href="https://redis.io/commands/xdelex">Redis Documentation: XDELEX</a>
623623
*/
624624
class DeleteExCommand extends KeyCommand {
@@ -702,7 +702,7 @@ public XDelOptions getOptions() {
702702
* {@code XACKDEL} command parameters.
703703
*
704704
* @author Viktoriya Kutsarova
705-
* @since 4.0
705+
* @since 4.1
706706
* @see <a href="https://redis.io/commands/xackdel">Redis Documentation: XACKDEL</a>
707707
*/
708708
class AcknowledgeDeleteCommand extends KeyCommand {
@@ -857,7 +857,7 @@ default Mono<Long> xDel(ByteBuffer key, RecordId... recordIds) {
857857
* @param recordIds stream record Id's.
858858
* @return {@link Flux} emitting {@link StreamEntryDeletionResult} for each ID.
859859
* @see <a href="https://redis.io/commands/xdelex">Redis Documentation: XDELEX</a>
860-
* @since 4.0
860+
* @since 4.1
861861
*/
862862
default Flux<StreamEntryDeletionResult> xDelEx(ByteBuffer key,
863863
XDelOptions options, String... recordIds) {
@@ -881,7 +881,7 @@ default Flux<StreamEntryDeletionResult> xDelEx(ByteBuffer key,
881881
* @param recordIds stream record Id's.
882882
* @return {@link Flux} emitting {@link StreamEntryDeletionResult} for each ID.
883883
* @see <a href="https://redis.io/commands/xdelex">Redis Documentation: XDELEX</a>
884-
* @since 4.0
884+
* @since 4.1
885885
*/
886886
default Flux<StreamEntryDeletionResult> xDelEx(ByteBuffer key,
887887
XDelOptions options, RecordId... recordIds) {
@@ -900,7 +900,7 @@ default Flux<StreamEntryDeletionResult> xDelEx(ByteBuffer key,
900900
* @param commands must not be {@literal null}.
901901
* @return {@link Flux} emitting a list of {@link StreamEntryDeletionResult} per {@link DeleteExCommand}.
902902
* @see <a href="https://redis.io/commands/xdelex">Redis Documentation: XDELEX</a>
903-
* @since 4.0
903+
* @since 4.1
904904
*/
905905
Flux<CommandResponse<DeleteExCommand, List<StreamEntryDeletionResult>>> xDelEx(
906906
Publisher<DeleteExCommand> commands);
@@ -917,7 +917,7 @@ Flux<CommandResponse<DeleteExCommand, List<StreamEntryDeletionResult>>> xDelEx(
917917
* @param recordIds stream record Id's.
918918
* @return {@link Flux} emitting {@link StreamEntryDeletionResult} for each ID.
919919
* @see <a href="https://redis.io/commands/xackdel">Redis Documentation: XACKDEL</a>
920-
* @since 4.0
920+
* @since 4.1
921921
*/
922922
default Flux<StreamEntryDeletionResult> xAckDel(ByteBuffer key, String group,
923923
XDelOptions options, String... recordIds) {
@@ -943,7 +943,7 @@ default Flux<StreamEntryDeletionResult> xAckDel(ByteBuffer key, String group,
943943
* @param recordIds stream record Id's.
944944
* @return {@link Flux} emitting {@link StreamEntryDeletionResult} for each ID.
945945
* @see <a href="https://redis.io/commands/xackdel">Redis Documentation: XACKDEL</a>
946-
* @since 4.0
946+
* @since 4.1
947947
*/
948948
default Flux<StreamEntryDeletionResult> xAckDel(ByteBuffer key, String group,
949949
XDelOptions options, RecordId... recordIds) {
@@ -963,7 +963,7 @@ default Flux<StreamEntryDeletionResult> xAckDel(ByteBuffer key, String group,
963963
* @param commands must not be {@literal null}.
964964
* @return {@link Flux} emitting a list of {@link StreamEntryDeletionResult} per {@link AcknowledgeDeleteCommand}.
965965
* @see <a href="https://redis.io/commands/xackdel">Redis Documentation: XACKDEL</a>
966-
* @since 4.0
966+
* @since 4.1
967967
*/
968968
Flux<CommandResponse<AcknowledgeDeleteCommand, List<StreamEntryDeletionResult>>> xAckDel(
969969
Publisher<AcknowledgeDeleteCommand> commands);
@@ -1233,7 +1233,7 @@ public PendingRecordsCommand consumer(String consumerName) {
12331233
*
12341234
* @param minIdleTime must not be {@literal null}.
12351235
* @return new instance of {@link PendingRecordsCommand}.
1236-
* @since 4.0
1236+
* @since 4.1
12371237
*/
12381238
public PendingRecordsCommand minIdleTime(Duration minIdleTime) {
12391239

@@ -1980,7 +1980,7 @@ public TrimCommand approximate(boolean approximateTrimming) {
19801980
*
19811981
* @param options the {@link XTrimOptions} to apply. Must not be {@literal null}.
19821982
* @return a new {@link TrimCommand} with the specified options applied.
1983-
* @since 4.0
1983+
* @since 4.1
19841984
*/
19851985
public TrimCommand options(XTrimOptions options) {
19861986
return new TrimCommand(getKey(), options);
@@ -2044,6 +2044,15 @@ default Mono<Long> xTrim(ByteBuffer key, long count, boolean approximateTrimming
20442044
.map(NumericResponse::getOutput);
20452045
}
20462046

2047+
/**
2048+
* Trims the stream to {@code count} elements.
2049+
*
2050+
* @param key the stream key.
2051+
* @param options the trim options
2052+
* @return {@link Mono} emitting the number of removed entries.
2053+
* @since 4.1
2054+
* @see <a href="https://redis.io/commands/xtrim">Redis Documentation: XTRIM</a>
2055+
*/
20472056
default Mono<Long> xTrim(ByteBuffer key, XTrimOptions options) {
20482057

20492058
Assert.notNull(key, "Key must not be null");

0 commit comments

Comments
 (0)