diff --git a/R/redis_api_generated.R b/R/redis_api_generated.R index 65d5bd0..43d8a37 100644 --- a/R/redis_api_generated.R +++ b/R/redis_api_generated.R @@ -1123,96 +1123,6 @@ redis_commands <- function(command) { assert_scalar_or_null2(COUNT) command(list("ZSCAN", key, cursor, cmd_command("MATCH", MATCH, FALSE), cmd_command("COUNT", COUNT, FALSE))) }, - XINFO = function(CONSUMERS = NULL, GROUPS = NULL, STREAM = NULL, help = NULL) { - assert_length_or_null(CONSUMERS, 2L) - assert_scalar_or_null2(GROUPS) - assert_scalar_or_null2(STREAM) - assert_match_value_or_null(help, c("HELP")) - command(list("XINFO", cmd_command("CONSUMERS", CONSUMERS, TRUE), cmd_command("GROUPS", GROUPS, FALSE), cmd_command("STREAM", STREAM, FALSE), help)) - }, - XADD = function(key, ID, field, value) { - assert_scalar2(key) - assert_scalar2(ID) - field <- cmd_interleave(field, value) - command(list("XADD", key, ID, field)) - }, - XTRIM = function(key, strategy, count, approx = NULL) { - assert_scalar2(key) - assert_match_value(strategy, c("MAXLEN")) - assert_match_value_or_null(approx, c("~")) - assert_scalar2(count) - command(list("XTRIM", key, strategy, approx, count)) - }, - XDEL = function(key, ID) { - assert_scalar2(key) - command(list("XDEL", key, ID)) - }, - XRANGE = function(key, start, end, COUNT = NULL) { - assert_scalar2(key) - assert_scalar2(start) - assert_scalar2(end) - assert_scalar_or_null2(COUNT) - command(list("XRANGE", key, start, end, cmd_command("COUNT", COUNT, FALSE))) - }, - XREVRANGE = function(key, end, start, COUNT = NULL) { - assert_scalar2(key) - assert_scalar2(end) - assert_scalar2(start) - assert_scalar_or_null2(COUNT) - command(list("XREVRANGE", key, end, start, cmd_command("COUNT", COUNT, FALSE))) - }, - XLEN = function(key) { - assert_scalar2(key) - command(list("XLEN", key)) - }, - XREAD = function(streams, key, id, COUNT = NULL, BLOCK = NULL) { - assert_scalar_or_null2(COUNT) - assert_scalar_or_null2(BLOCK) - assert_match_value(streams, c("STREAMS")) - command(list("XREAD", cmd_command("COUNT", COUNT, FALSE), cmd_command("BLOCK", BLOCK, FALSE), streams, key, id)) - }, - XGROUP = function(CREATE = NULL, SETID = NULL, DESTROY = NULL, CREATECONSUMER = NULL, DELCONSUMER = NULL) { - assert_length_or_null(CREATE, 3L) - assert_length_or_null(SETID, 3L) - assert_length_or_null(DESTROY, 2L) - assert_length_or_null(CREATECONSUMER, 3L) - assert_length_or_null(DELCONSUMER, 3L) - command(list("XGROUP", cmd_command("CREATE", CREATE, TRUE), cmd_command("SETID", SETID, TRUE), cmd_command("DESTROY", DESTROY, TRUE), cmd_command("CREATECONSUMER", CREATECONSUMER, TRUE), cmd_command("DELCONSUMER", DELCONSUMER, TRUE))) - }, - XREADGROUP = function(GROUP, streams, key, ID, COUNT = NULL, BLOCK = NULL, noack = NULL) { - assert_length(GROUP, 2L) - assert_scalar_or_null2(COUNT) - assert_scalar_or_null2(BLOCK) - assert_match_value_or_null(noack, c("NOACK")) - assert_match_value(streams, c("STREAMS")) - command(list("XREADGROUP", cmd_command("GROUP", GROUP, TRUE), cmd_command("COUNT", COUNT, FALSE), cmd_command("BLOCK", BLOCK, FALSE), noack, streams, key, ID)) - }, - XACK = function(key, group, ID) { - assert_scalar2(key) - assert_scalar2(group) - command(list("XACK", key, group, ID)) - }, - XCLAIM = function(key, group, consumer, min_idle_time, ID, IDLE = NULL, TIME = NULL, RETRYCOUNT = NULL, force = NULL, justid = NULL) { - assert_scalar2(key) - assert_scalar2(group) - assert_scalar2(consumer) - assert_scalar2(min_idle_time) - assert_scalar_or_null2(IDLE) - assert_scalar_or_null2(TIME) - assert_scalar_or_null2(RETRYCOUNT) - assert_match_value_or_null(force, c("FORCE")) - assert_match_value_or_null(justid, c("JUSTID")) - command(list("XCLAIM", key, group, consumer, min_idle_time, ID, cmd_command("IDLE", IDLE, FALSE), cmd_command("TIME", TIME, FALSE), cmd_command("RETRYCOUNT", RETRYCOUNT, FALSE), force, justid)) - }, - XPENDING = function(key, group, start = NULL, end = NULL, count = NULL, consumer = NULL) { - assert_scalar2(key) - assert_scalar2(group) - assert_scalar_or_null2(start) - assert_scalar_or_null2(end) - assert_scalar_or_null2(count) - assert_scalar_or_null2(consumer) - command(list("XPENDING", key, group, start, end, count, consumer)) - }, LATENCY_DOCTOR = function() { command(list("LATENCY", "DOCTOR")) }, @@ -1461,19 +1371,6 @@ cmd_since <- numeric_version(c( UNWATCH = "2.2.0", WAIT = "3.0.0", WATCH = "2.2.0", - XACK = "5.0.0", - XADD = "5.0.0", - XCLAIM = "5.0.0", - XDEL = "5.0.0", - XGROUP = "5.0.0", - XINFO = "5.0.0", - XLEN = "5.0.0", - XPENDING = "5.0.0", - XRANGE = "5.0.0", - XREAD = "5.0.0", - XREADGROUP = "5.0.0", - XREVRANGE = "5.0.0", - XTRIM = "5.0.0", ZADD = "1.2.0", ZCARD = "1.2.0", ZCOUNT = "2.0.0", diff --git a/extra/generate_fun.R b/extra/generate_fun.R index bc19615..e74e654 100644 --- a/extra/generate_fun.R +++ b/extra/generate_fun.R @@ -242,6 +242,10 @@ read_commands <- function() { ## Filter commands for releasedness: ok <- !vlapply(cmds, function(x) is.null(x$since)) cmds <- cmds[ok] + + ## Drop the redis stream (X*) commands: + cmds <- cmds[!vlapply(cmds, function(x) x$group == "stream")] + for (i in seq_along(cmds)) { cmds[[i]]$name <- names(cmds)[[i]] cmds[[i]]$name_r <- clean_name(cmds[[i]]$name) diff --git a/tests/testthat/test-zzz-commands-stream.R b/tests/testthat/test-zzz-commands-stream.R deleted file mode 100644 index 29b83ed..0000000 --- a/tests/testthat/test-zzz-commands-stream.R +++ /dev/null @@ -1,112 +0,0 @@ -context("commands (stream)") - -test_that("XADD", { - skip_if_cmd_unsupported("XADD") - con <- test_hiredis_connection() - stream <- rand_str() - id1 <- con$XADD(stream, "*", c("name", "surname"), c("Sara", "OConnor")) - id2 <- con$XADD(stream, "*", paste0("field", 1:3), paste0("value", 1:3)) - expect_equal(con$XLEN(stream), 2) - expect_equal( - con$XRANGE(stream, "-", "+"), - list( - list( - id1, - list("name", "Sara", "surname", "OConnor")), - list( - id2, - list("field1", "value1", "field2", "value2", "field3", "value3")))) -}) - - -test_that("XDEL", { - skip_if_cmd_unsupported("XDEL") - con <- test_hiredis_connection() - stream <- rand_str() - id1 <- con$XADD(stream, "*", "a", 1) - id2 <- con$XADD(stream, "*", "b", 2) - id3 <- con$XADD(stream, "*", "c", 3) - con$XDEL(stream, id2) - expect_equal( - con$XRANGE(stream, "-", "+"), - list(list(id1, list("a", "1")), - list(id3, list("c", "3")))) -}) - - -test_that("XLEN", { - skip_if_cmd_unsupported("XLEN") - con <- test_hiredis_connection() - stream <- rand_str() - id1 <- con$XADD(stream, "*", "a", 1) - id2 <- con$XADD(stream, "*", "b", 2) - id3 <- con$XADD(stream, "*", "c", 3) - expect_equal(con$XLEN(stream), 3) -}) - - -## Adopted from the docs examples -test_that("XACK", { - expect_equal(redis_cmds$XACK("mystream", "mygroup", "1526569495631-0"), - list("XACK", "mystream", "mygroup", "1526569495631-0")) -}) - -test_that("XCLAIM", { - expect_equal( - redis_cmds$XCLAIM("mystream", "mygroup", "Alice", 3600000, - "1526569498055-0"), - list("XCLAIM", "mystream", "mygroup", "Alice", 3600000, "1526569498055-0", - NULL, NULL, NULL, NULL, NULL)) -}) - -## This lot feels like it might want splitting apart? XGROUP_CREATE etc? -test_that("XGROUP", { - expect_equal( - redis_cmds$XGROUP(CREATE = c("mystream", "consumer-group-name", "$")), - list("XGROUP", list("CREATE", c("mystream", "consumer-group-name", "$")), - NULL, NULL, NULL, NULL)) - expect_equal( - redis_cmds$XGROUP(CREATE = c("mystream", "consumer-group-name", 0)), - list("XGROUP", list("CREATE", c("mystream", "consumer-group-name", 0)), - NULL, NULL, NULL, NULL)) - ## TODO: MKSTREAM not supported for CREATE - - expect_equal( - redis_cmds$XGROUP(DESTROY = c("mystream", "consumer-group-name")), - list("XGROUP", NULL, NULL, - list("DESTROY", c("mystream", "consumer-group-name")), NULL, NULL)) - - expect_equal( - redis_cmds$XGROUP(CREATECONSUMER = c("mystream", "consumer-group-name", - "myconsumer123")), - list("XGROUP", NULL, NULL, NULL, - list("CREATECONSUMER", c("mystream", "consumer-group-name", - "myconsumer123")), NULL)) - - expect_equal( - redis_cmds$XGROUP(DELCONSUMER = c("mystream", "consumer-group-name", - "myconsumer123")), - list("XGROUP", NULL, NULL, NULL, NULL, - list("DELCONSUMER", c("mystream", "consumer-group-name", - "myconsumer123")))) - - expect_equal( - redis_cmds$XGROUP(SETID = c("mystream", "consumer-group-name", 0)), - list("XGROUP", NULL, - list("SETID", c("mystream", "consumer-group-name", 0)), - NULL, NULL, NULL)) -}) - - -test_that("XINFO", { - expect_equal( - redis_cmds$XINFO(STREAM = "mystream"), - list("XINFO", NULL, NULL, list("STREAM", "mystream"), NULL)) - expect_equal( - redis_cmds$XINFO(GROUPS = "mystream"), - list("XINFO", NULL, list("GROUPS", "mystream"), NULL, NULL)) - expect_equal( - redis_cmds$XINFO(CONSUMERS = c("mystream", "mygroup")), - list("XINFO", list("CONSUMERS", c("mystream", "mygroup")), - NULL, NULL, NULL)) -})