58
58
* @author Christoph Strobl
59
59
* @author Tugdual Grall
60
60
* @author Dengliming
61
+ * @author Mark John Moreno
61
62
* @since 2.2
62
63
*/
63
64
public interface ReactiveStreamCommands {
@@ -199,12 +200,14 @@ class AddStreamRecord extends KeyCommand {
199
200
200
201
private final ByteBufferRecord record ;
201
202
private final @ Nullable Long maxlen ;
203
+ private final boolean nomkstream ;
202
204
203
- private AddStreamRecord (ByteBufferRecord record , @ Nullable Long maxlen ) {
205
+ private AddStreamRecord (ByteBufferRecord record , @ Nullable Long maxlen , boolean nomkstream ) {
204
206
205
207
super (record .getStream ());
206
208
this .record = record ;
207
209
this .maxlen = maxlen ;
210
+ this .nomkstream = nomkstream ;
208
211
}
209
212
210
213
/**
@@ -217,7 +220,7 @@ public static AddStreamRecord of(ByteBufferRecord record) {
217
220
218
221
Assert .notNull (record , "Record must not be null!" );
219
222
220
- return new AddStreamRecord (record , null );
223
+ return new AddStreamRecord (record , null , false );
221
224
}
222
225
223
226
/**
@@ -230,7 +233,7 @@ public static AddStreamRecord body(Map<ByteBuffer, ByteBuffer> body) {
230
233
231
234
Assert .notNull (body , "Body must not be null!" );
232
235
233
- return new AddStreamRecord (StreamRecords .rawBuffer (body ), null );
236
+ return new AddStreamRecord (StreamRecords .rawBuffer (body ), null , false );
234
237
}
235
238
236
239
/**
@@ -240,7 +243,7 @@ public static AddStreamRecord body(Map<ByteBuffer, ByteBuffer> body) {
240
243
* @return a new {@link ReactiveGeoCommands.GeoAddCommand} with {@literal key} applied.
241
244
*/
242
245
public AddStreamRecord to (ByteBuffer key ) {
243
- return new AddStreamRecord (record .withStreamKey (key ), maxlen );
246
+ return new AddStreamRecord (record .withStreamKey (key ), maxlen , false );
244
247
}
245
248
246
249
/**
@@ -249,7 +252,26 @@ public AddStreamRecord to(ByteBuffer key) {
249
252
* @return new instance of {@link AddStreamRecord}.
250
253
*/
251
254
public AddStreamRecord maxlen (long maxlen ) {
252
- return new AddStreamRecord (record , maxlen );
255
+ return new AddStreamRecord (record , maxlen , false );
256
+ }
257
+
258
+ /**
259
+ * Disable creation of stream if it does not already exist.
260
+ *
261
+ * @return new instance of {@link AddStreamRecord}.
262
+ */
263
+ public AddStreamRecord makeNoStream () {
264
+ return new AddStreamRecord (record , maxlen , true );
265
+ }
266
+
267
+ /**
268
+ * Disable creation of stream if it does not already exist.
269
+ *
270
+ * @param maxlen size of the stream to the given maximum number of elements.
271
+ * @return new instance of {@link AddStreamRecord}.
272
+ */
273
+ public AddStreamRecord makeNoStream (long maxlen ) {
274
+ return new AddStreamRecord (record , maxlen , true );
253
275
}
254
276
255
277
/**
@@ -281,6 +303,13 @@ public Long getMaxlen() {
281
303
public boolean hasMaxlen () {
282
304
return maxlen != null && maxlen > 0 ;
283
305
}
306
+
307
+ /**
308
+ * @return {@literal true} if {@literal NOMKSTREAM} is set.
309
+ */
310
+ public boolean isNoMkStream () {
311
+ return nomkstream ;
312
+ }
284
313
}
285
314
286
315
/**
0 commit comments