yam-redis-with-retries 2.2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. data/CHANGELOG.md +53 -0
  2. data/LICENSE +20 -0
  3. data/README.md +208 -0
  4. data/Rakefile +277 -0
  5. data/benchmarking/logging.rb +62 -0
  6. data/benchmarking/pipeline.rb +51 -0
  7. data/benchmarking/speed.rb +21 -0
  8. data/benchmarking/suite.rb +24 -0
  9. data/benchmarking/thread_safety.rb +38 -0
  10. data/benchmarking/worker.rb +71 -0
  11. data/examples/basic.rb +15 -0
  12. data/examples/dist_redis.rb +43 -0
  13. data/examples/incr-decr.rb +17 -0
  14. data/examples/list.rb +26 -0
  15. data/examples/pubsub.rb +31 -0
  16. data/examples/sets.rb +36 -0
  17. data/examples/unicorn/config.ru +3 -0
  18. data/examples/unicorn/unicorn.rb +20 -0
  19. data/lib/redis.rb +1166 -0
  20. data/lib/redis/client.rb +265 -0
  21. data/lib/redis/compat.rb +21 -0
  22. data/lib/redis/connection.rb +9 -0
  23. data/lib/redis/connection/command_helper.rb +45 -0
  24. data/lib/redis/connection/hiredis.rb +49 -0
  25. data/lib/redis/connection/registry.rb +12 -0
  26. data/lib/redis/connection/ruby.rb +135 -0
  27. data/lib/redis/connection/synchrony.rb +129 -0
  28. data/lib/redis/distributed.rb +694 -0
  29. data/lib/redis/hash_ring.rb +131 -0
  30. data/lib/redis/pipeline.rb +34 -0
  31. data/lib/redis/retry.rb +128 -0
  32. data/lib/redis/subscribe.rb +94 -0
  33. data/lib/redis/version.rb +3 -0
  34. data/test/commands_on_hashes_test.rb +20 -0
  35. data/test/commands_on_lists_test.rb +60 -0
  36. data/test/commands_on_sets_test.rb +78 -0
  37. data/test/commands_on_sorted_sets_test.rb +109 -0
  38. data/test/commands_on_strings_test.rb +80 -0
  39. data/test/commands_on_value_types_test.rb +88 -0
  40. data/test/connection_handling_test.rb +88 -0
  41. data/test/distributed_blocking_commands_test.rb +53 -0
  42. data/test/distributed_commands_on_hashes_test.rb +12 -0
  43. data/test/distributed_commands_on_lists_test.rb +24 -0
  44. data/test/distributed_commands_on_sets_test.rb +85 -0
  45. data/test/distributed_commands_on_strings_test.rb +50 -0
  46. data/test/distributed_commands_on_value_types_test.rb +73 -0
  47. data/test/distributed_commands_requiring_clustering_test.rb +148 -0
  48. data/test/distributed_connection_handling_test.rb +25 -0
  49. data/test/distributed_internals_test.rb +27 -0
  50. data/test/distributed_key_tags_test.rb +53 -0
  51. data/test/distributed_persistence_control_commands_test.rb +24 -0
  52. data/test/distributed_publish_subscribe_test.rb +101 -0
  53. data/test/distributed_remote_server_control_commands_test.rb +43 -0
  54. data/test/distributed_sorting_test.rb +21 -0
  55. data/test/distributed_test.rb +59 -0
  56. data/test/distributed_transactions_test.rb +34 -0
  57. data/test/encoding_test.rb +16 -0
  58. data/test/error_replies_test.rb +53 -0
  59. data/test/helper.rb +145 -0
  60. data/test/internals_test.rb +163 -0
  61. data/test/lint/hashes.rb +126 -0
  62. data/test/lint/internals.rb +37 -0
  63. data/test/lint/lists.rb +93 -0
  64. data/test/lint/sets.rb +66 -0
  65. data/test/lint/sorted_sets.rb +167 -0
  66. data/test/lint/strings.rb +137 -0
  67. data/test/lint/value_types.rb +84 -0
  68. data/test/persistence_control_commands_test.rb +22 -0
  69. data/test/pipelining_commands_test.rb +123 -0
  70. data/test/publish_subscribe_test.rb +158 -0
  71. data/test/redis_mock.rb +80 -0
  72. data/test/remote_server_control_commands_test.rb +82 -0
  73. data/test/retry_test.rb +225 -0
  74. data/test/sorting_test.rb +44 -0
  75. data/test/synchrony_driver.rb +57 -0
  76. data/test/test.conf +8 -0
  77. data/test/thread_safety_test.rb +30 -0
  78. data/test/transactions_test.rb +100 -0
  79. data/test/unknown_commands_test.rb +14 -0
  80. data/test/url_param_test.rb +60 -0
  81. metadata +215 -0
@@ -0,0 +1,100 @@
1
+ # encoding: UTF-8
2
+
3
+ require File.expand_path("./helper", File.dirname(__FILE__))
4
+
5
+ setup do
6
+ init Redis.new(OPTIONS)
7
+ end
8
+
9
+ test "MULTI/DISCARD" do |r|
10
+ r.multi
11
+
12
+ assert "QUEUED" == r.set("foo", "1")
13
+ assert "QUEUED" == r.get("foo")
14
+
15
+ r.discard
16
+
17
+ assert nil == r.get("foo")
18
+ end
19
+
20
+ test "MULTI/EXEC with a block" do |r|
21
+ r.multi do |multi|
22
+ multi.set "foo", "s1"
23
+ end
24
+
25
+ assert "s1" == r.get("foo")
26
+
27
+ assert_raise(RuntimeError) do
28
+ r.multi do |multi|
29
+ multi.set "bar", "s2"
30
+ raise "Some error"
31
+ multi.set "baz", "s3"
32
+ end
33
+ end
34
+
35
+ assert nil == r.get("bar")
36
+ assert nil == r.get("baz")
37
+ end
38
+
39
+ test "Don't raise (and ignore) immediate error in MULTI/EXEC" do |r|
40
+ result = r.multi do |m|
41
+ m.set("foo", "s1")
42
+ m.unknown_command
43
+ end
44
+
45
+ assert 1 == result.size
46
+ assert "OK" == result.first
47
+ assert "s1" == r.get("foo")
48
+ end
49
+
50
+ test "Don't raise delayed error in MULTI/EXEC" do |r|
51
+ result = r.multi do |m|
52
+ m.set("foo", "s1")
53
+ m.incr("foo") # not an integer
54
+ m.lpush("foo", "value") # wrong kind of value
55
+ end
56
+
57
+ assert result[1].message =~ /not an integer/i
58
+ assert result[2].message =~ /wrong kind of value/i
59
+ assert "s1" == r.get("foo")
60
+ end
61
+
62
+ test "MULTI with a block yielding the client" do |r|
63
+ r.multi do |multi|
64
+ multi.set "foo", "s1"
65
+ end
66
+
67
+ assert "s1" == r.get("foo")
68
+ end
69
+
70
+ test "WATCH with an unmodified key" do |r|
71
+ r.watch "foo"
72
+ r.multi do |multi|
73
+ multi.set "foo", "s1"
74
+ end
75
+
76
+ assert "s1" == r.get("foo")
77
+ end
78
+
79
+ test "WATCH with a modified key" do |r|
80
+ r.watch "foo"
81
+ r.set "foo", "s1"
82
+ res = r.multi do |multi|
83
+ multi.set "foo", "s2"
84
+ end
85
+
86
+ assert nil == res
87
+ assert "s1" == r.get("foo")
88
+ end
89
+
90
+ test "UNWATCH with a modified key" do |r|
91
+ r.watch "foo"
92
+ r.set "foo", "s1"
93
+ r.unwatch
94
+ r.multi do |multi|
95
+ multi.set "foo", "s2"
96
+ end
97
+
98
+ assert "s2" == r.get("foo")
99
+ end
100
+
@@ -0,0 +1,14 @@
1
+ # encoding: UTF-8
2
+
3
+ require File.expand_path("./helper", File.dirname(__FILE__))
4
+
5
+ setup do
6
+ init Redis.new(OPTIONS)
7
+ end
8
+
9
+ test "should try to work" do |r|
10
+ assert_raise RuntimeError do
11
+ r.not_yet_implemented_command
12
+ end
13
+ end
14
+
@@ -0,0 +1,60 @@
1
+ # encoding: UTF-8
2
+
3
+ require File.expand_path("./helper", File.dirname(__FILE__))
4
+
5
+ test "URL defaults to 127.0.0.1:6379" do
6
+ redis = Redis.connect
7
+
8
+ assert "127.0.0.1" == redis.client.host
9
+ assert 6379 == redis.client.port
10
+ assert 0 == redis.client.db
11
+ assert nil == redis.client.password
12
+ end
13
+
14
+ test "allows to pass in a URL" do
15
+ redis = Redis.connect :url => "redis://:secr3t@foo.com:999/2"
16
+
17
+ assert "foo.com" == redis.client.host
18
+ assert 999 == redis.client.port
19
+ assert 2 == redis.client.db
20
+ assert "secr3t" == redis.client.password
21
+ end
22
+
23
+ test "override URL if path option is passed" do
24
+ redis = Redis.connect :url => "redis://:secr3t@foo.com/foo:999/2", :path => "/tmp/redis.sock"
25
+
26
+ assert "/tmp/redis.sock" == redis.client.path
27
+ assert nil == redis.client.host
28
+ assert nil == redis.client.port
29
+ end
30
+
31
+ test "overrides URL if another connection option is passed" do
32
+ redis = Redis.connect :url => "redis://:secr3t@foo.com:999/2", :port => 1000
33
+
34
+ assert "foo.com" == redis.client.host
35
+ assert 1000 == redis.client.port
36
+ assert 2 == redis.client.db
37
+ assert "secr3t" == redis.client.password
38
+ end
39
+
40
+ test "does not modify the passed options" do
41
+ options = { :url => "redis://:secr3t@foo.com:999/2" }
42
+
43
+ redis = Redis.connect(options)
44
+
45
+ assert({ :url => "redis://:secr3t@foo.com:999/2" } == options)
46
+ end
47
+
48
+ test "uses REDIS_URL over default if available" do
49
+ ENV["REDIS_URL"] = "redis://:secr3t@foo.com:999/2"
50
+
51
+ redis = Redis.connect
52
+
53
+ assert "foo.com" == redis.client.host
54
+ assert 999 == redis.client.port
55
+ assert 2 == redis.client.db
56
+ assert "secr3t" == redis.client.password
57
+
58
+ ENV.delete("REDIS_URL")
59
+ end
60
+
metadata ADDED
@@ -0,0 +1,215 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: yam-redis-with-retries
3
+ version: !ruby/object:Gem::Version
4
+ hash: 117
5
+ prerelease:
6
+ segments:
7
+ - 2
8
+ - 2
9
+ - 2
10
+ - 1
11
+ version: 2.2.2.1
12
+ platform: ruby
13
+ authors:
14
+ - Ezra Zygmuntowicz
15
+ - Taylor Weibley
16
+ - Matthew Clark
17
+ - Brian McKinney
18
+ - Salvatore Sanfilippo
19
+ - Luca Guidi
20
+ - Michel Martens
21
+ - Damian Janowski
22
+ - Pieter Noordhuis
23
+ autorequire:
24
+ bindir: bin
25
+ cert_chain: []
26
+
27
+ date: 2011-10-14 00:00:00 -07:00
28
+ default_executable:
29
+ dependencies: []
30
+
31
+ description: Ruby client library for Redis, the key value storage server
32
+ email: ez@engineyard.com
33
+ executables: []
34
+
35
+ extensions: []
36
+
37
+ extra_rdoc_files: []
38
+
39
+ files:
40
+ - lib/redis.rb
41
+ - lib/redis/client.rb
42
+ - lib/redis/compat.rb
43
+ - lib/redis/pipeline.rb
44
+ - lib/redis/retry.rb
45
+ - lib/redis/hash_ring.rb
46
+ - lib/redis/distributed.rb
47
+ - lib/redis/subscribe.rb
48
+ - lib/redis/version.rb
49
+ - lib/redis/connection/command_helper.rb
50
+ - lib/redis/connection/ruby.rb
51
+ - lib/redis/connection/registry.rb
52
+ - lib/redis/connection/synchrony.rb
53
+ - lib/redis/connection/hiredis.rb
54
+ - lib/redis/connection.rb
55
+ - CHANGELOG.md
56
+ - README.md
57
+ - LICENSE
58
+ - Rakefile
59
+ - test/commands_on_strings_test.rb
60
+ - test/distributed_persistence_control_commands_test.rb
61
+ - test/commands_on_value_types_test.rb
62
+ - test/distributed_remote_server_control_commands_test.rb
63
+ - test/synchrony_driver.rb
64
+ - test/distributed_commands_on_sets_test.rb
65
+ - test/redis_mock.rb
66
+ - test/distributed_publish_subscribe_test.rb
67
+ - test/encoding_test.rb
68
+ - test/distributed_key_tags_test.rb
69
+ - test/distributed_connection_handling_test.rb
70
+ - test/distributed_test.rb
71
+ - test/distributed_sorting_test.rb
72
+ - test/retry_test.rb
73
+ - test/thread_safety_test.rb
74
+ - test/distributed_transactions_test.rb
75
+ - test/sorting_test.rb
76
+ - test/publish_subscribe_test.rb
77
+ - test/distributed_commands_on_hashes_test.rb
78
+ - test/internals_test.rb
79
+ - test/url_param_test.rb
80
+ - test/error_replies_test.rb
81
+ - test/commands_on_hashes_test.rb
82
+ - test/commands_on_sorted_sets_test.rb
83
+ - test/distributed_commands_on_strings_test.rb
84
+ - test/pipelining_commands_test.rb
85
+ - test/distributed_commands_on_value_types_test.rb
86
+ - test/distributed_internals_test.rb
87
+ - test/unknown_commands_test.rb
88
+ - test/persistence_control_commands_test.rb
89
+ - test/test.conf
90
+ - test/helper.rb
91
+ - test/distributed_blocking_commands_test.rb
92
+ - test/distributed_commands_on_lists_test.rb
93
+ - test/lint/sets.rb
94
+ - test/lint/sorted_sets.rb
95
+ - test/lint/hashes.rb
96
+ - test/lint/value_types.rb
97
+ - test/lint/strings.rb
98
+ - test/lint/internals.rb
99
+ - test/lint/lists.rb
100
+ - test/connection_handling_test.rb
101
+ - test/commands_on_sets_test.rb
102
+ - test/commands_on_lists_test.rb
103
+ - test/transactions_test.rb
104
+ - test/remote_server_control_commands_test.rb
105
+ - test/distributed_commands_requiring_clustering_test.rb
106
+ - benchmarking/pipeline.rb
107
+ - benchmarking/suite.rb
108
+ - benchmarking/speed.rb
109
+ - benchmarking/thread_safety.rb
110
+ - benchmarking/logging.rb
111
+ - benchmarking/worker.rb
112
+ - examples/dist_redis.rb
113
+ - examples/sets.rb
114
+ - examples/unicorn/unicorn.rb
115
+ - examples/unicorn/config.ru
116
+ - examples/list.rb
117
+ - examples/pubsub.rb
118
+ - examples/basic.rb
119
+ - examples/incr-decr.rb
120
+ has_rdoc: true
121
+ homepage: http://github.com/yammer/redis-rb
122
+ licenses: []
123
+
124
+ post_install_message:
125
+ rdoc_options: []
126
+
127
+ require_paths:
128
+ - lib
129
+ required_ruby_version: !ruby/object:Gem::Requirement
130
+ none: false
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ hash: 3
135
+ segments:
136
+ - 0
137
+ version: "0"
138
+ required_rubygems_version: !ruby/object:Gem::Requirement
139
+ none: false
140
+ requirements:
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ hash: 3
144
+ segments:
145
+ - 0
146
+ version: "0"
147
+ requirements: []
148
+
149
+ rubyforge_project: redis-rb
150
+ rubygems_version: 1.5.3
151
+ signing_key:
152
+ specification_version: 3
153
+ summary: Ruby client library for Redis, the key value storage server
154
+ test_files:
155
+ - test/commands_on_strings_test.rb
156
+ - test/distributed_persistence_control_commands_test.rb
157
+ - test/commands_on_value_types_test.rb
158
+ - test/distributed_remote_server_control_commands_test.rb
159
+ - test/synchrony_driver.rb
160
+ - test/distributed_commands_on_sets_test.rb
161
+ - test/redis_mock.rb
162
+ - test/distributed_publish_subscribe_test.rb
163
+ - test/encoding_test.rb
164
+ - test/distributed_key_tags_test.rb
165
+ - test/distributed_connection_handling_test.rb
166
+ - test/distributed_test.rb
167
+ - test/distributed_sorting_test.rb
168
+ - test/retry_test.rb
169
+ - test/thread_safety_test.rb
170
+ - test/distributed_transactions_test.rb
171
+ - test/sorting_test.rb
172
+ - test/publish_subscribe_test.rb
173
+ - test/distributed_commands_on_hashes_test.rb
174
+ - test/internals_test.rb
175
+ - test/url_param_test.rb
176
+ - test/error_replies_test.rb
177
+ - test/commands_on_hashes_test.rb
178
+ - test/commands_on_sorted_sets_test.rb
179
+ - test/distributed_commands_on_strings_test.rb
180
+ - test/pipelining_commands_test.rb
181
+ - test/distributed_commands_on_value_types_test.rb
182
+ - test/distributed_internals_test.rb
183
+ - test/unknown_commands_test.rb
184
+ - test/persistence_control_commands_test.rb
185
+ - test/test.conf
186
+ - test/helper.rb
187
+ - test/distributed_blocking_commands_test.rb
188
+ - test/distributed_commands_on_lists_test.rb
189
+ - test/lint/sets.rb
190
+ - test/lint/sorted_sets.rb
191
+ - test/lint/hashes.rb
192
+ - test/lint/value_types.rb
193
+ - test/lint/strings.rb
194
+ - test/lint/internals.rb
195
+ - test/lint/lists.rb
196
+ - test/connection_handling_test.rb
197
+ - test/commands_on_sets_test.rb
198
+ - test/commands_on_lists_test.rb
199
+ - test/transactions_test.rb
200
+ - test/remote_server_control_commands_test.rb
201
+ - test/distributed_commands_requiring_clustering_test.rb
202
+ - benchmarking/pipeline.rb
203
+ - benchmarking/suite.rb
204
+ - benchmarking/speed.rb
205
+ - benchmarking/thread_safety.rb
206
+ - benchmarking/logging.rb
207
+ - benchmarking/worker.rb
208
+ - examples/dist_redis.rb
209
+ - examples/sets.rb
210
+ - examples/unicorn/unicorn.rb
211
+ - examples/unicorn/config.ru
212
+ - examples/list.rb
213
+ - examples/pubsub.rb
214
+ - examples/basic.rb
215
+ - examples/incr-decr.rb