diff options
author | Roey Prat <roey.prat@redislabs.com> | 2018-10-29 10:50:50 +0200 |
---|---|---|
committer | Roey Prat <roey.prat@redislabs.com> | 2018-10-31 09:34:42 +0200 |
commit | bb30ec5aae98c9649008303eacdcc64034bd506c (patch) | |
tree | d2c7c40338cb89fe3716d4616ed778e66f731042 | |
parent | b24d007716f77627ee0b0999eb5b997baf976fc1 (diff) | |
download | redis-py-bb30ec5aae98c9649008303eacdcc64034bd506c.tar.gz |
remove code duplication
-rwxr-xr-x | redis/client.py | 52 | ||||
-rw-r--r-- | tests/test_commands.py | 30 |
2 files changed, 0 insertions, 82 deletions
diff --git a/redis/client.py b/redis/client.py index 4751f9d..2b39c2d 100755 --- a/redis/client.py +++ b/redis/client.py @@ -1923,58 +1923,6 @@ class StrictRedis(object): pieces.append(maxlen) return self.execute_command('XTRIM', name, *pieces) - def xinfo_stream(self, name): - """ - Returns general information about the stream. - name: name of the stream. - """ - return self.execute_command('XINFO STREAM', name) - - def xinfo_consumers(self, name, groupname): - """ - Returns general information about the consumers in the group. - name: name of the stream. - groupname: name of the consumer group. - """ - return self.execute_command('XINFO CONSUMERS', name, groupname) - - def xinfo_groups(self, name): - """ - Returns general information about the consumer groups of the stream. - name: name of the stream. - """ - return self.execute_command('XINFO GROUPS', name) - - def xack(self, name, groupname, *ids): - """ - Acknowledges the successful processing of one or more messages. - name: name of the stream. - groupname: name of the consumer group. - *ids: message ids to acknowlege. - """ - return self.execute_command('XACK', name, groupname, *ids) - - def xdel(self, name, *ids): - """ - Deletes one or more messages from a stream. - name: name of the stream. - *ids: message ids to delete. - """ - return self.execute_command('XDEL', name, *ids) - - def xtrim(self, name, maxlen, approximate=True): - """ - Trims old messages from a stream. - name: name of the stream. - maxlen: truncate old stream messages beyond this size - approximate: actual stream length may be slightly more than maxlen - """ - pieces = [Token.get_token('MAXLEN')] - if approximate: - pieces.append('~') - pieces.append(maxlen) - return self.execute_command('XTRIM', name, *pieces) - def xreadgroup(self, groupname, consumername, streams, count=None, block=None): """ diff --git a/tests/test_commands.py b/tests/test_commands.py index 7ecc9f4..a79d6a3 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -1754,36 +1754,6 @@ class TestStrictCommands(object): assert sr.xack(stream_name, group_name, *[x for x in range(5)]) == 0 @skip_if_server_version_lt('5.0.0') - def test_strict_xdel(self, sr): - stream_name = 'xdel_test_stream' - sr.delete(stream_name) - - assert sr.xdel(stream_name, 1) == 0 - - sr.xadd(stream_name, {"foo": "bar"}, id=1) - assert sr.xdel(stream_name, 1) == 1 - - stamp = sr.xadd(stream_name, {"baz": "qaz"}) - assert sr.xdel(stream_name, 1, stamp) == 1 - assert sr.xdel(stream_name, 1, stamp, 42) == 0 - - @skip_if_server_version_lt('5.0.0') - def test_strict_xtrim(self, sr): - stream_name = 'xtrim_test_stream' - sr.delete(stream_name) - - assert sr.xtrim(stream_name, 1000) == 0 - - for i in range(300): - sr.xadd(stream_name, {"index": i}) - - assert sr.xtrim(stream_name, 1000, approximate=False) == 0 - assert sr.xtrim(stream_name, 300) == 0 - assert sr.xtrim(stream_name, 299) == 0 - assert sr.xtrim(stream_name, 234) == 0 - assert sr.xtrim(stream_name, 234, approximate=False) == 66 - - @skip_if_server_version_lt('5.0.0') def test_strict_xclaim(self, sr): stream_name = 'xclaim_test_stream' group_name = 'xclaim_test_consumer_group' |