spbtv_redis_failover 1.0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +19 -0
  3. data/.travis.yml +7 -0
  4. data/.yardopts +6 -0
  5. data/Changes.md +191 -0
  6. data/Gemfile +2 -0
  7. data/LICENSE +22 -0
  8. data/README.md +240 -0
  9. data/Rakefile +9 -0
  10. data/bin/redis_node_manager +7 -0
  11. data/examples/config.yml +17 -0
  12. data/examples/multiple_environments_config.yml +15 -0
  13. data/lib/redis_failover.rb +25 -0
  14. data/lib/redis_failover/cli.rb +142 -0
  15. data/lib/redis_failover/client.rb +517 -0
  16. data/lib/redis_failover/errors.rb +54 -0
  17. data/lib/redis_failover/failover_strategy.rb +25 -0
  18. data/lib/redis_failover/failover_strategy/latency.rb +21 -0
  19. data/lib/redis_failover/manual_failover.rb +52 -0
  20. data/lib/redis_failover/node.rb +190 -0
  21. data/lib/redis_failover/node_manager.rb +741 -0
  22. data/lib/redis_failover/node_snapshot.rb +81 -0
  23. data/lib/redis_failover/node_strategy.rb +34 -0
  24. data/lib/redis_failover/node_strategy/consensus.rb +18 -0
  25. data/lib/redis_failover/node_strategy/majority.rb +18 -0
  26. data/lib/redis_failover/node_strategy/single.rb +17 -0
  27. data/lib/redis_failover/node_watcher.rb +83 -0
  28. data/lib/redis_failover/runner.rb +27 -0
  29. data/lib/redis_failover/util.rb +137 -0
  30. data/lib/redis_failover/version.rb +3 -0
  31. data/misc/redis_failover.png +0 -0
  32. data/spbtv_redis_failover.gemspec +26 -0
  33. data/spec/cli_spec.rb +75 -0
  34. data/spec/client_spec.rb +153 -0
  35. data/spec/failover_strategy/latency_spec.rb +41 -0
  36. data/spec/failover_strategy_spec.rb +17 -0
  37. data/spec/node_manager_spec.rb +136 -0
  38. data/spec/node_snapshot_spec.rb +30 -0
  39. data/spec/node_spec.rb +84 -0
  40. data/spec/node_strategy/consensus_spec.rb +30 -0
  41. data/spec/node_strategy/majority_spec.rb +22 -0
  42. data/spec/node_strategy/single_spec.rb +22 -0
  43. data/spec/node_strategy_spec.rb +22 -0
  44. data/spec/node_watcher_spec.rb +58 -0
  45. data/spec/spec_helper.rb +21 -0
  46. data/spec/support/config/multiple_environments.yml +15 -0
  47. data/spec/support/config/multiple_environments_with_chroot.yml +17 -0
  48. data/spec/support/config/single_environment.yml +7 -0
  49. data/spec/support/config/single_environment_with_chroot.yml +8 -0
  50. data/spec/support/node_manager_stub.rb +87 -0
  51. data/spec/support/redis_stub.rb +105 -0
  52. data/spec/util_spec.rb +21 -0
  53. metadata +207 -0
data/spec/util_spec.rb ADDED
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ module RedisFailover
4
+ describe Util do
5
+ describe '.symbolize_keys' do
6
+ it 'converts hash keys to symbols' do
7
+ Util.symbolize_keys('a' => 1, 'b' => 2).should == {:a => 1, :b => 2}
8
+ end
9
+ end
10
+
11
+ describe '.different?' do
12
+ it 'handles different arrays' do
13
+ Util.different?([1,2,3], [1,5,3]).should be_true
14
+ end
15
+
16
+ it 'handles non-different arrays' do
17
+ Util.different?([1,2,3], [3,2,1]).should be_false
18
+ end
19
+ end
20
+ end
21
+ end
metadata ADDED
@@ -0,0 +1,207 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spbtv_redis_failover
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.2.1
5
+ platform: ruby
6
+ authors:
7
+ - Ryan LeCompte
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-06-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: redis
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '2.2'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '4'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '2.2'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '4'
33
+ - !ruby/object:Gem::Dependency
34
+ name: redis-namespace
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: multi_json
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '1'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '1'
61
+ - !ruby/object:Gem::Dependency
62
+ name: zk
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '1.9'
68
+ - - "<"
69
+ - !ruby/object:Gem::Version
70
+ version: '1.10'
71
+ type: :runtime
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '1.9'
78
+ - - "<"
79
+ - !ruby/object:Gem::Version
80
+ version: '1.10'
81
+ - !ruby/object:Gem::Dependency
82
+ name: rake
83
+ requirement: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - "<"
86
+ - !ruby/object:Gem::Version
87
+ version: '11.0'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - "<"
93
+ - !ruby/object:Gem::Version
94
+ version: '11.0'
95
+ - !ruby/object:Gem::Dependency
96
+ name: rspec
97
+ requirement: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - "<"
100
+ - !ruby/object:Gem::Version
101
+ version: '3.0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - "<"
107
+ - !ruby/object:Gem::Version
108
+ version: '3.0'
109
+ - !ruby/object:Gem::Dependency
110
+ name: yard
111
+ requirement: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ type: :development
117
+ prerelease: false
118
+ version_requirements: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ description: redis_failover is a ZooKeeper-based automatic master/slave failover solution
124
+ for Ruby
125
+ email:
126
+ - lecompte@gmail.com
127
+ executables:
128
+ - redis_node_manager
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - ".gitignore"
133
+ - ".travis.yml"
134
+ - ".yardopts"
135
+ - Changes.md
136
+ - Gemfile
137
+ - LICENSE
138
+ - README.md
139
+ - Rakefile
140
+ - bin/redis_node_manager
141
+ - examples/config.yml
142
+ - examples/multiple_environments_config.yml
143
+ - lib/redis_failover.rb
144
+ - lib/redis_failover/cli.rb
145
+ - lib/redis_failover/client.rb
146
+ - lib/redis_failover/errors.rb
147
+ - lib/redis_failover/failover_strategy.rb
148
+ - lib/redis_failover/failover_strategy/latency.rb
149
+ - lib/redis_failover/manual_failover.rb
150
+ - lib/redis_failover/node.rb
151
+ - lib/redis_failover/node_manager.rb
152
+ - lib/redis_failover/node_snapshot.rb
153
+ - lib/redis_failover/node_strategy.rb
154
+ - lib/redis_failover/node_strategy/consensus.rb
155
+ - lib/redis_failover/node_strategy/majority.rb
156
+ - lib/redis_failover/node_strategy/single.rb
157
+ - lib/redis_failover/node_watcher.rb
158
+ - lib/redis_failover/runner.rb
159
+ - lib/redis_failover/util.rb
160
+ - lib/redis_failover/version.rb
161
+ - misc/redis_failover.png
162
+ - spbtv_redis_failover.gemspec
163
+ - spec/cli_spec.rb
164
+ - spec/client_spec.rb
165
+ - spec/failover_strategy/latency_spec.rb
166
+ - spec/failover_strategy_spec.rb
167
+ - spec/node_manager_spec.rb
168
+ - spec/node_snapshot_spec.rb
169
+ - spec/node_spec.rb
170
+ - spec/node_strategy/consensus_spec.rb
171
+ - spec/node_strategy/majority_spec.rb
172
+ - spec/node_strategy/single_spec.rb
173
+ - spec/node_strategy_spec.rb
174
+ - spec/node_watcher_spec.rb
175
+ - spec/spec_helper.rb
176
+ - spec/support/config/multiple_environments.yml
177
+ - spec/support/config/multiple_environments_with_chroot.yml
178
+ - spec/support/config/single_environment.yml
179
+ - spec/support/config/single_environment_with_chroot.yml
180
+ - spec/support/node_manager_stub.rb
181
+ - spec/support/redis_stub.rb
182
+ - spec/util_spec.rb
183
+ homepage: http://github.com/ryanlecompte/redis_failover
184
+ licenses: []
185
+ metadata: {}
186
+ post_install_message:
187
+ rdoc_options: []
188
+ require_paths:
189
+ - lib
190
+ required_ruby_version: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ required_rubygems_version: !ruby/object:Gem::Requirement
196
+ requirements:
197
+ - - ">="
198
+ - !ruby/object:Gem::Version
199
+ version: '0'
200
+ requirements: []
201
+ rubyforge_project:
202
+ rubygems_version: 2.6.11
203
+ signing_key:
204
+ specification_version: 4
205
+ summary: redis_failover is a ZooKeeper-based automatic master/slave failover solution
206
+ for Ruby
207
+ test_files: []