zookeeper-ng 1.5.2.1-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +7 -0
  2. data/.ctags_paths +1 -0
  3. data/.dotfiles/ruby-gemset +1 -0
  4. data/.dotfiles/ruby-version +1 -0
  5. data/.dotfiles/rvmrc +2 -0
  6. data/.github/workflows/build.yml +57 -0
  7. data/.gitignore +19 -0
  8. data/.gitmodules +3 -0
  9. data/CHANGELOG +408 -0
  10. data/Gemfile +30 -0
  11. data/Guardfile +8 -0
  12. data/LICENSE +23 -0
  13. data/Manifest +29 -0
  14. data/README.markdown +62 -0
  15. data/Rakefile +121 -0
  16. data/cause-abort.rb +117 -0
  17. data/ext/.gitignore +6 -0
  18. data/ext/Rakefile +41 -0
  19. data/ext/c_zookeeper.rb +398 -0
  20. data/ext/common.h +17 -0
  21. data/ext/dbg.h +53 -0
  22. data/ext/depend +5 -0
  23. data/ext/event_lib.c +740 -0
  24. data/ext/event_lib.h +175 -0
  25. data/ext/extconf.rb +103 -0
  26. data/ext/generate_gvl_code.rb +321 -0
  27. data/ext/patches/zkc-3.3.5-network.patch +24 -0
  28. data/ext/patches/zkc-3.4.5-buffer-overflow.patch +11 -0
  29. data/ext/patches/zkc-3.4.5-config.patch +5454 -0
  30. data/ext/patches/zkc-3.4.5-fetch-and-add.patch +16 -0
  31. data/ext/patches/zkc-3.4.5-logging.patch +41 -0
  32. data/ext/patches/zkc-3.4.5-out-of-order-ping.patch +163 -0
  33. data/ext/patches/zkc-3.4.5-yosemite-htonl-fix.patch +102 -0
  34. data/ext/zkc-3.4.5.tar.gz +0 -0
  35. data/ext/zkrb.c +1080 -0
  36. data/ext/zkrb_wrapper.c +775 -0
  37. data/ext/zkrb_wrapper.h +350 -0
  38. data/ext/zkrb_wrapper_compat.c +15 -0
  39. data/ext/zkrb_wrapper_compat.h +11 -0
  40. data/ext/zookeeper_base.rb +256 -0
  41. data/java/java_base.rb +501 -0
  42. data/lib/zookeeper/acls.rb +44 -0
  43. data/lib/zookeeper/callbacks.rb +108 -0
  44. data/lib/zookeeper/client.rb +30 -0
  45. data/lib/zookeeper/client_methods.rb +282 -0
  46. data/lib/zookeeper/common/queue_with_pipe.rb +110 -0
  47. data/lib/zookeeper/common.rb +122 -0
  48. data/lib/zookeeper/compatibility.rb +138 -0
  49. data/lib/zookeeper/constants.rb +97 -0
  50. data/lib/zookeeper/continuation.rb +223 -0
  51. data/lib/zookeeper/core_ext.rb +58 -0
  52. data/lib/zookeeper/em_client.rb +55 -0
  53. data/lib/zookeeper/exceptions.rb +135 -0
  54. data/lib/zookeeper/forked.rb +19 -0
  55. data/lib/zookeeper/latch.rb +34 -0
  56. data/lib/zookeeper/logger/forwarding_logger.rb +84 -0
  57. data/lib/zookeeper/logger.rb +39 -0
  58. data/lib/zookeeper/monitor.rb +19 -0
  59. data/lib/zookeeper/rake_tasks.rb +165 -0
  60. data/lib/zookeeper/request_registry.rb +153 -0
  61. data/lib/zookeeper/stat.rb +21 -0
  62. data/lib/zookeeper/version.rb +4 -0
  63. data/lib/zookeeper.rb +115 -0
  64. data/notes.txt +14 -0
  65. data/scripts/upgrade-1.0-sed-alike.rb +46 -0
  66. data/spec/c_zookeeper_spec.rb +51 -0
  67. data/spec/chrooted_connection_spec.rb +83 -0
  68. data/spec/compatibilty_spec.rb +8 -0
  69. data/spec/default_watcher_spec.rb +41 -0
  70. data/spec/em_spec.rb +51 -0
  71. data/spec/ext/zookeeper_base_spec.rb +19 -0
  72. data/spec/forked_connection_spec.rb +122 -0
  73. data/spec/latch_spec.rb +24 -0
  74. data/spec/log4j.properties +17 -0
  75. data/spec/shared/all_success_return_values.rb +10 -0
  76. data/spec/shared/connection_examples.rb +1081 -0
  77. data/spec/spec_helper.rb +61 -0
  78. data/spec/support/00_logging.rb +38 -0
  79. data/spec/support/10_spawn_zookeeper.rb +20 -0
  80. data/spec/support/progress_formatter.rb +15 -0
  81. data/spec/support/zookeeper_spec_helpers.rb +96 -0
  82. data/spec/zookeeper_spec.rb +24 -0
  83. data/zookeeper.gemspec +46 -0
  84. data/zoomonkey/duplicates +3 -0
  85. data/zoomonkey/zoomonkey.rb +194 -0
  86. metadata +185 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2bae09098db9dde363fe6c7a1dc3dec6e16742adb264b816f3a1f3fa74397afd
4
+ data.tar.gz: c06ed9f06b9c07001ba2896a84fdbccbc786e9494306ac1dd8f2ccb0237183d5
5
+ SHA512:
6
+ metadata.gz: 887eb8b655345250052c598051717e4150e80ae9d6ca0745277fc57b15d1dfa2b318722dee3cfe4e21517eecc4de9bc3ad852489d827991e625eec08965f3f84
7
+ data.tar.gz: bfdada1f2447cadfb6ee6074705ce82b9082ff9f44fbe58a03b7a762bc19c353663c504c2e9c15d5ea0a4b2ded427dc3fe555b9973c8a2837aca2c52f7c136a4
data/.ctags_paths ADDED
@@ -0,0 +1 @@
1
+ ~/vendor/ruby/*.{c,h}
@@ -0,0 +1 @@
1
+ zookeeper
@@ -0,0 +1 @@
1
+ ruby-1.9.3-p429
data/.dotfiles/rvmrc ADDED
@@ -0,0 +1,2 @@
1
+ rvm ruby-1.9.3@zookeeper --create
2
+ export ZK_DEV=1
@@ -0,0 +1,57 @@
1
+ on:
2
+ pull_request:
3
+ branches:
4
+ - master
5
+ push:
6
+ branches:
7
+ - master
8
+
9
+ jobs:
10
+ build:
11
+ name: Ruby ${{ matrix.ruby }} / GCC ${{ matrix.gcc }} / ${{ matrix.os }}
12
+ runs-on: ${{ matrix.os }}
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ os:
17
+ - ubuntu-latest
18
+ - macos-latest
19
+ ruby:
20
+ - '2.5'
21
+ - '2.6'
22
+ - '2.7'
23
+ - '3.0'
24
+ - '3.1'
25
+ - 'jruby'
26
+ gcc:
27
+ - 7
28
+ - latest
29
+ exclude:
30
+ - os: macos-latest
31
+ gcc: 7
32
+
33
+ steps:
34
+ - uses: actions/checkout@v2
35
+ with:
36
+ submodules: recursive
37
+
38
+ - name: Set up GCC
39
+ if: ${{ matrix.gcc != 'latest' }}
40
+ uses: egor-tensin/setup-gcc@v1
41
+ with:
42
+ version: ${{ matrix.gcc }}
43
+ platform: x64
44
+
45
+ - name: Set up Ruby
46
+ uses: ruby/setup-ruby@v1
47
+ with:
48
+ ruby-version: ${{ matrix.ruby }}
49
+ bundler-cache: true
50
+ cache-version: 1_${{ matrix.ruby }}_${{ matrix.os }}
51
+
52
+ - name: Run Tests
53
+ env:
54
+ RAILS_ENV: test
55
+ SPAWN_ZOOKEEPER: true
56
+ run: |
57
+ bundle exec rake
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ *.gem
2
+ *.o
3
+ *.so
4
+ *~
5
+ *.log
6
+ Makefile
7
+ pkg
8
+ zookeeper.gemspec
9
+ Gemfile.*
10
+ tmp/
11
+ .rvmrc
12
+ .zkserver
13
+ coverage
14
+
15
+ *.swp
16
+ *.swo
17
+
18
+ .ruby-gemset
19
+ .ruby-version
data/.gitmodules ADDED
@@ -0,0 +1,3 @@
1
+ [submodule "releaseops"]
2
+ path = releaseops
3
+ url = https://github.com/zk-ruby/releaseops.git
data/CHANGELOG ADDED
@@ -0,0 +1,408 @@
1
+ v1.5.2
2
+ * Ruby 3.1 compatibility (h/t: @casperisfine)
3
+
4
+ v1.5.1
5
+ * Update config.guess to support newer environments (h/t: @malmckay)
6
+
7
+ v1.5.0
8
+ * (housekeeping) Moves build to Github Actions from TravisCI
9
+ * (housekeeping) Drops build support for MRI Ruby < 2.5 and other rubies
10
+ * Build on Ruby 3 (#99) (h/t: @malmckay)
11
+ * Build on MacOS (#98) (h/t: @malmckay)
12
+ * Work around compiler errors on newer versions of gcc (#97) (h/t: @nickmarden)
13
+ * Fix a typo on a has_key (#83) (h/t: @lexspoon)
14
+ * Adds support macOS dylib (#86) (h/t: @pftg)
15
+ * Fix compilation on ARM (#82) (h/t: @cdonati)
16
+
17
+ v1.4.11
18
+ * backported fix for ZOOKEEPER-2253 by @chchen - #76
19
+
20
+ v1.4.10
21
+
22
+ * fix for ruby 2.2.0 build - #74 (h/t: fbernier)
23
+
24
+ v1.4.9
25
+
26
+ * Fix for build on OS-X 10.10 by @e0en
27
+
28
+ v1.4.8
29
+
30
+ * Fix deadlock related to state checks that can happen during reconnecting
31
+
32
+ v1.4.7
33
+
34
+ * Fixing dependent library compilation on FreeBSD 10 #53 (h/t: gogreen53)
35
+
36
+ v1.4.6
37
+
38
+ * Fix two issues with dealing with unresponsive zookeeper servers
39
+ that would prevent the client from properly recovering the session
40
+ (including one in the Apache ZooKeeper C library — see ZOOKEEPER-1756
41
+ for more details)
42
+ * Reduce the chances of seeing Zookeeper::Exceptions::NotConnected
43
+ exceptions by only submitting new commands if we are connected
44
+ * Prevent commands from being queued to be sent to the server if the
45
+ session has expired which will solve most cases involving the
46
+ Zookeeper::Exceptions::ContinuationTimeoutError exception
47
+ * Upgrade the Apache ZooKeeper C library to 3.4.5 (client is backward
48
+ compatible with 3.3 servers). The Java library has not been updated.
49
+ * Cleanup complaints from compiler for uninitialized variable access
50
+
51
+ v1.4.5
52
+
53
+ * Allow passing :session_id and :session_password options #42 (thanks to avalanche123)
54
+ * Fix permissions constants #46, #47, #48 (thanks to jaeho-kim)
55
+ * Allow JRuby to read nil values #44 (thanks to reidmorrison)
56
+
57
+
58
+ v1.4.4 fix build under FreeBSD (h/t: stass)
59
+
60
+ * https://github.com/slyphon/zookeeper/pull/40
61
+
62
+ v1.4.3 fix build for ruby 2.0.0-rc2
63
+
64
+ * https://github.com/slyphon/zookeeper/pull/34
65
+
66
+ v1.4.2 fix a bug in the forwarding logger format string
67
+
68
+ v1.4.1 merge pull request 29 - fix exception handling in jruby 1.7.x
69
+
70
+ * h/t to @dynamix for the patch
71
+
72
+
73
+ v1.4.0 Removed the 'logging' gem
74
+
75
+ * At the request of a user, use of the logging gem has been discontinued as
76
+ it appears to cause a fair amount of RSS memory bloating (8MB was
77
+ reported). It's been replaced by a fairly simple ad-hoc implementation
78
+ using the stdlib 'logger' class. No user impact is expected unless you were
79
+ adjusting the Loggers on components of zookeeper.
80
+
81
+ v1.3.0 much needed refactor of event and async result delivery
82
+
83
+ * event and async blocks were previously mixed in with a bunch of other
84
+ common code, and shared a Monitor with other unrelated functionality. This
85
+ code has been gently refactored into its own self-contained class (with its
86
+ own task-specific lock), which should help with maintenance.
87
+
88
+ v1.2.14 merge add_auth pull request, reduce chances for ContinuationTimeoutError
89
+
90
+ * added support for the add_auth call (h/t: @bradhe) see pull req #25
91
+
92
+ * fix a corner case where some pending Continuations may get stuck without
93
+ being shutdown when the event thread exits. This would lead to a
94
+ ContinuationTimeoutError being raised after 30s as a failsafe.
95
+
96
+ v1.2.13 fix build under rbenv
97
+
98
+ * h/t to Eric Lindvall for fixing #22 in http://git.io/PEPgnA
99
+ build reportedly works in rbenv now.
100
+
101
+ v1.2.12 improve locking in dispatch_next_callback
102
+
103
+ * Possible fix for an edgy NoMethodError on nil
104
+
105
+ v1.2.11 remove dependency on backports gem
106
+
107
+ * Somewhat naively we were requiring the backports gem to provide
108
+ Kernel#require_relative. This release implements similar functionlity
109
+ inside the Zookeeper module and doesn't affect the global namespace.
110
+
111
+ We apologise for the inconvenience.
112
+
113
+ v1.2.10 minor bug fix in java code
114
+
115
+ * Don't obscure a legitimate exception because of an unexpected nil
116
+
117
+ v1.2.7 further lock adjustments, deadlock risk reduction
118
+
119
+ * Refactor ZookeeperBase to not hold onto the mutex while waiting
120
+ for the dispatch thread to exit and the CZookeeper instance to close.
121
+ Instead, lock, nil out @czk, and unlock (which will cause all calls to
122
+ raise NotConnected), and then carry on with the shutdown procedure, greatly
123
+ reducing the chances of a deadlock. Also add a hardcoded 30 second timeout
124
+ to the join of the shutdown thread, that way we won't hang indefinitely in
125
+ the case of an unforseen condition.
126
+
127
+ * Improve the CZookeeper#wait_until_connected to use a deadline approach
128
+ to waiting for both running and connected states. Also, handle the
129
+ 'nil' (wait forever) timeout properly.
130
+
131
+ * Wake all waiting threads on all ConditionVariables when CZookeeper#shut_down!
132
+ is called
133
+
134
+ v1.2.6 fix build on fedora
135
+
136
+ v1.2.5 cleanup locking in ZookeeperBase
137
+
138
+ * There were several situations where we would hold the lock before calling
139
+ a method on CZookeeper (inquisitors and #create in particular). This
140
+ exposed us to deadlocks in situations where an async event would be
141
+ delivered (probably a SESSION_EXPIRED event), but the callback block could
142
+ not be called because the dispatch thread would block on the mutex being
143
+ held by the caller of create.
144
+
145
+ This version cleans up that usage, and ensures that the only time we hold
146
+ the mutex is during startup/shutdown (when the value of @czk may be changing),
147
+ and in all other cases we grab the mutex, dereference, and unlock then perform
148
+ whatever action on the reference.
149
+
150
+ * Add a safety net to Continuation (which will soon be called 'Promise' or
151
+ 'Future' at the request of @eric). If any operation takes more than 30s
152
+ an exception will be raised in the calling thread. The session timeout
153
+ setting makes it so that no operation should take more than 20s, so we know
154
+ if we haven't received a reply in *longer* than that, something has gone
155
+ awry.
156
+
157
+ v1.2.4 fix buffer overflow in CZookeeper client_id code
158
+
159
+ * the 'passwd' part of the struct is a char[16], but isn't null terminated.
160
+ use rb_str_new with an explicit length, rather than rb_str_new2 which
161
+ uses strlen().
162
+
163
+ v1.2.3 ensure that all threads are woken up on shutdown
164
+
165
+ * There was an edge case where a call would be queued up and its thread
166
+ sleeping waiting for a response, but that response would never come because
167
+ the connection was shut down. This version includes a patch for that case
168
+ to ensure that if a call is in 'pending' state, and shutdown time arrives
169
+ that all pending threads will receive a Zookeeper::Exceptions::NotConnected
170
+ exception.
171
+
172
+ v1.2.2 avoid race while waiting for connection
173
+
174
+ * There was a possible race in CZookeeper#wait_until_connected where if we
175
+ couldn't connect to the port specified (localhost:28271) then we wound up
176
+ burning 100% CPU and spinning. This solution fixes that by hooking into the
177
+ event delivery and keeping track of what the current state is. When there's
178
+ a change, we use a ConditionVariable to wake up threads that were waiting
179
+ until the connection was connected. Additionally, we now respect the
180
+ timeout parameter again.
181
+
182
+ v1.2.1 simplify assert_open
183
+
184
+ * The client methods were all calling assert_open before performing an
185
+ action. This was meant as a fail-early lightweight check of the connection
186
+ state and it worked well when we were running against the mt code. Now this
187
+ requires us to use a Continuation and make our way through the event loop.
188
+ There is a possible deadlock this release should solve that was caused by
189
+ the assert_open code holding a lock while making an async call through
190
+ the event loop. This is no longer the case. The assert_open call only checks
191
+ that the current handle hasn't been closed, the connection-state checking
192
+ now occurs before submitting a request on the event iteration thread, and
193
+ the behavior should be the same as it was before. If the underlying
194
+ connection is not in the 'connected' state, an exception will be raised.
195
+
196
+ v1.2.0 Stop the World, I Wanna fork()
197
+
198
+ * changed pause/resume methods to pause_before_fork_in_parent
199
+ and resume_after_fork_in_parent to match their ZK counterparts
200
+
201
+ * replaced the Queue in QueueWithPipe (really have to change that name)
202
+ with an Array and Mutex/ConditionVariable pair. This allows us to
203
+ have better control over the shutdown signaling, and lets us resume
204
+ operations after a pause.
205
+
206
+
207
+ v1.1.1 Cleanup after code review (h/t @eric)
208
+
209
+ * While hunting down this bug: https://bugs.ruby-lang.org/issues/6438
210
+ Eric Lindvall made a number of helpful catches.
211
+
212
+ * Reduce syscall overhead by not using an unnecessary pipe in the event_lib.c
213
+ implementation
214
+
215
+ * More careful use of rb_raise, don't longjmp past necessary free() calls.
216
+
217
+ * More careful malloc in the get() implementation (we need to allocate 1MB
218
+ to hold the data in a znode, but only in the SYNC cases).
219
+
220
+
221
+ v1.1.0 Rewrite C backend to use zookeeper_st, the async library
222
+
223
+ * In order to ensure fork safety, a rewrite of the backend was necessary.
224
+ It was impossible to guarantee with the mt lib that a lock would not
225
+ be held by a thread when fork() was called, which opened up the possibility
226
+ for corruption and other badness.
227
+
228
+ This version contains a Continuation class, which allows us to present a
229
+ synchronous front-end to the asynchronous backend. All features are still
230
+ supported, no special action is necessary to prepare for a fork, and the
231
+ post-fork procedure is the same as before: call reopen() in the child,
232
+ continue on in the parent like nothing happened.
233
+
234
+ v1.0.6 Only include backports if RUBY_VERSION is 1.8.x
235
+
236
+ * 'backports' pollutes too much, use sparingly
237
+
238
+ v1.0.5 Minor cleanup
239
+
240
+ * Fix the InheritedConnectionError message
241
+
242
+ * Clean up the module includes
243
+
244
+ v1.0.3 Linux: Fix hang on reopen after fork
245
+
246
+ * Linux users relying on fork() should upgrade to 1.0.3, as it
247
+ fixes a bug in the reopen code that would cause a hang in the child.
248
+ If you're running on linux, you *really* should upgrade
249
+
250
+ v1.0.0 Single Zookeeper namespace
251
+
252
+ * The top level Zookeeper class is now a module, the former Zookeeper
253
+ class is now Zookeeper::Client
254
+
255
+ * Consolidate the 6 top-level namespaces into one, Zookeeper module
256
+
257
+ ZookeeperCommon -> Zookeeper::Common
258
+ ZookeeperCallbacks -> Zookeeper::Callbacks
259
+ ZookeeperConstants -> Zookeeper::Constants
260
+ ZookeeperExceptions -> Zookeeper::Exceptions
261
+ ZookeeperACLs -> Zookeeper::ACLs
262
+ CZookeeper -> Zookeeper::CZookeeper
263
+
264
+ * Added a 'zookeeper/compatibility' file that will define the old names
265
+ and look up the new constants for users, and print a warning telling them
266
+ the change has occurred and that they should update their code
267
+
268
+ * Added scripts/upgrade-1.0-sed-alike.rb which will basically do a
269
+ find-and-replace, changing the old names to the new names (worked on
270
+ both the Zookeeper and ZK codebases).
271
+
272
+ * Java and C now use different names for the base class, to avoid the
273
+ possibility of error. Java is now JavaBase, C remains ZookeeperBase.
274
+
275
+ * All client methods are defined in the ClientMethods module and mixed
276
+ into the constructed Client class.
277
+
278
+ * Fix all requires, no longer monkey with $LOAD_PATH, use require_relative
279
+
280
+ * Bugfix for C client.
281
+
282
+ Because we release the GIL, there's the possibilty that in the middle of a
283
+ synchronous C call, ruby will have switched thread contexts and one of
284
+ those threads will call close. It seems that during normal operation, this
285
+ is not a problem, but during shutdown, this causes CPU to spike to 100% and
286
+ a deadlock. This fix essentially wraps every call to the C layer in a
287
+ mutex. There may be a slightly less heavyweight optimization in the future,
288
+ but this is the safest option at the moment.
289
+
290
+ v0.9.3 Event thread shutdown fix, Windows compatibility fix
291
+
292
+ * Use a 'shutdown thread' to coordinate cleanup if close is called from the
293
+ event thread (prevents deadlock)
294
+
295
+ * Default Logger now uses $stderr instead of opening /dev/null [#16]
296
+
297
+ * Gemfile/gemspec/Rakefile refactoring.
298
+
299
+ v0.9.2 More efficient and simpler wrappers for GIL release
300
+
301
+ * After a code review by Andrew Wason (rectalogic), use a much simpler
302
+ technique for creating the arg structs and passing them to the
303
+ zkrb_gvl_* functions. No malloc(), no free(), no problem.
304
+
305
+ v0.9.1 see v0.8.4 notes, same patch
306
+
307
+ v0.9.0 RELEASE THE KRAK..er, GIL!!
308
+
309
+ * In >= 1.9.2 the ruby interpreter allows you to release the GIL when
310
+ calling into native code, sounds like a good idea.
311
+
312
+ This release makes use of that code by parsing the zookeeper.h header file
313
+ and extracting the method signatures of all relevant zoo_* functions, then
314
+ generating boilerplate that allows us to call those functions via the
315
+ rb_thread_blocking_region function.
316
+
317
+ 1.8.7 compatibility is maintained by stubbing out that functionality if built
318
+ under 1.8.7.
319
+
320
+ * 1.8.7 is deprecated! I will continue to support 1.8.7 for the near future
321
+ but sometime soon, you're gonna have to upgrade.
322
+
323
+ v0.8.4 fix NameError, require 'forwardable'
324
+
325
+ * Really not sure why this didn't come up in tests
326
+
327
+ * issue here https://github.com/slyphon/zk/issues/22
328
+
329
+ v0.8.3 fix NonLocalJump exception in event delivery thread shutdown code
330
+
331
+ * hit a corner case where we're waiting for the zkc handle setup
332
+ and the user decides to shutdown, but before we've had a chance
333
+ to enter the delivery loop.
334
+
335
+ * Cleaned up some nasty code in ZookeeperConstants
336
+
337
+ * removed ZookeeperConstants#print_events and ZookeeperConstants#print_states
338
+
339
+ * changed EVENT_TYPE_NAMES and EVENT_STATE_NAMES in ZookeeperConstants
340
+ to use string values instead of symbols
341
+
342
+ v0.8.2 fix close after a fork()
343
+
344
+ * The dispatch thread will be dead in this situation, so we need to
345
+ check to see if it's already dead before waiting on it to exit.
346
+
347
+ v0.8.1 Java client fix, silence warnings
348
+
349
+ v0.8.0 Refactor C implementaion, EventMachine client
350
+
351
+ * separated CZookeeper and ZookeeperBase implementation
352
+
353
+ This solves issues with reopen not working properly, makes for a much
354
+ cleaner event delivery implementation. ZookeeperBase controls the lifecycle
355
+ of the event dispatch thread now, rather than it being tied to CZookeeper.
356
+
357
+ * added support for the 'sync' API call
358
+
359
+ * Refactored zookeeper_c.c and zookeeper_lib.c
360
+
361
+ More error checking in zookeeper_lib.c and restructure some things to make
362
+ logic easier to follow
363
+
364
+ Fix bug in method_get_next_event that made the shutdown case so complicated
365
+
366
+ * Massively simplified EMClient implementation
367
+
368
+ Rather than trying to hook the IO used by zookeeper_lib to notify zookeeper_c
369
+ about event availabiltiy directly into EventMachine, use the same event delivery
370
+ thread, but wrap the dispatch call in EM.schedule.
371
+
372
+ * Improve implementation of spin-lock-esque code that waits for the connection to be
373
+ established before returning.
374
+
375
+ This cut the test runtime down from 1m 20s to 2s.
376
+
377
+ * Java client refactoring, similar correctness changes
378
+
379
+ * Change ZookeeperException base class to StandardError instead of Exception
380
+
381
+
382
+ v0.4.5 Upgrade to ZooKeeper 3.3.3
383
+
384
+ v0.4.4 Fix race condition on close, possible data corruption on async get.
385
+
386
+ v0.4.3 Fix a handful of memory-related bugs, fix SIGSEGV on master change, reduce latency of event handling, fix compilation on OSX.
387
+
388
+ v0.4.2 Add options to Zookeeper#initialize, silence most Zookeeper logs.
389
+
390
+ v0.4.1 Upgrade to ZooKeeper 3.3.2
391
+
392
+ v0.4.0. More attr-readers (StarvingMarvin) and 1.9 compatibility (tsuraan)
393
+
394
+ v0.3.2. Handle close, closed connections and expired sessions a little more gracefully.
395
+
396
+ v0.3.1. ACL bugfix.
397
+
398
+ v0.3.0. Wickman's rewrite, breaks dependencies from myelin/emaland port.
399
+
400
+ v0.2.2. Fix compatibility with stock Leopard fat-binary Ruby.
401
+
402
+ v0.2.1. No more camelcase classname.
403
+
404
+ v0.2. Bundle C dependencies, like memcached.gem.
405
+
406
+ v0.1. First release.
407
+
408
+ # vim:ft=text:ts=2:sw=2:et
data/Gemfile ADDED
@@ -0,0 +1,30 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ gem 'rake', '~> 0.9.0'
6
+
7
+ group :test do
8
+ gem "rspec" , "~> 2.11"
9
+ gem 'eventmachine', '1.0.4'
10
+ gem 'evented-spec', '~> 0.9.0'
11
+ gem 'zk-server', '~> 1.0', :git => 'https://github.com/zk-ruby/zk-server.git'
12
+ end
13
+
14
+ # ffs, :platform appears to be COMLETELY BROKEN so we just DO THAT HERE
15
+ # ...BY HAND
16
+
17
+ if RUBY_VERSION != '1.8.7' && !defined?(JRUBY_VERSION)
18
+ gem 'simplecov', :group => :coverage, :require => false
19
+ gem 'yard', '~> 0.8.0', :group => :docs
20
+ gem 'redcarpet', :group => :docs
21
+
22
+ group :development do
23
+ gem 'pry'
24
+ gem 'guard', :require => false
25
+ gem 'guard-rspec', :require => false
26
+ gem 'guard-shell', :require => false
27
+ end
28
+ end
29
+
30
+ # vim:ft=ruby
data/Guardfile ADDED
@@ -0,0 +1,8 @@
1
+
2
+ guard 'rspec', :version => 2, :cli => '-c -f progress --fail-fast' do
3
+ watch(%r{^spec/.+_spec.rb$})
4
+ watch(%r{^lib/(.+)\.rb$}) { |m| %w[spec/zookeeper_spec.rb spec/chrooted_connection_spec.rb] }
5
+ watch(%r{^ext/zookeeper_c.bundle}) { %w[spec/c_zookeeper_spec.rb] }
6
+ watch(%r{^ext/zookeeper_base.rb}) { "spec" }
7
+ end
8
+
data/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ (The MIT License)
2
+
3
+ Copyright (C) 2008 Phillip Pearson
4
+ Copyright (C) 2010 Twitter, Inc.
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining
7
+ a copy of this software and associated documentation files (the
8
+ 'Software'), to deal in the Software without restriction, including
9
+ without limitation the rights to use, copy, modify, merge, publish,
10
+ distribute, sublicense, and/or sell copies of the Software, and to
11
+ permit persons to whom the Software is furnished to do so, subject to
12
+ the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be
15
+ included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Manifest ADDED
@@ -0,0 +1,29 @@
1
+ CHANGELOG
2
+ LICENSE
3
+ Manifest
4
+ README
5
+ Rakefile
6
+ examples/cloud_config.rb
7
+ ext/extconf.rb
8
+ ext/zkc-3.3.4.tar.gz
9
+ ext/zookeeper_base.rb
10
+ ext/zookeeper_c.c
11
+ ext/zookeeper_lib.c
12
+ ext/zookeeper_lib.h
13
+ java/zookeeper_base.rb
14
+ lib/zookeeper.rb
15
+ lib/zookeeper/acls.rb
16
+ lib/zookeeper/callbacks.rb
17
+ lib/zookeeper/common.rb
18
+ lib/zookeeper/constants.rb
19
+ lib/zookeeper/exceptions.rb
20
+ lib/zookeeper/stat.rb
21
+ spec/log4j.properties
22
+ spec/spec_helper.rb
23
+ spec/zookeeper_spec.rb
24
+ test/test_basic.rb
25
+ test/test_callback1.rb
26
+ test/test_close.rb
27
+ test/test_esoteric.rb
28
+ test/test_watcher1.rb
29
+ test/test_watcher2.rb
data/README.markdown ADDED
@@ -0,0 +1,62 @@
1
+ # zookeeper #
2
+
3
+ ![Build Status](https://github.com/zk-ruby/zookeeper/actions/workflows/build.yml/badge.svg)
4
+
5
+
6
+ An interface to the Zookeeper cluster coordination server.
7
+
8
+ For a higher-level interface with a more convenient API and features such as locks, have a look at [ZK](https://github.com/zk-ruby/zk).
9
+
10
+ ## Fork Safety! ##
11
+
12
+ As of 1.1.0, this library is fork-safe (which was not easy to accomplish). This means you can use it without worry in unicorn, resque, and whatever other fork-philic frameworks you sick little monkeys are using this week. The only rule is that after a fork(), you need to call `#reopen` on the client ASAP, because if you try to peform any other action, an exception will be raised. Other than that, there is no special action that is needed in the parent.
13
+
14
+ ## License
15
+
16
+ Copyright 2008 Phillip Pearson, and 2010 Twitter, Inc.
17
+ Licensed under the MIT License. See the included LICENSE file.
18
+
19
+ Portions copyright 2008-2010 the Apache Software Foundation, licensed under the
20
+ Apache 2 license, and used with permission.
21
+
22
+ Portions contributed to the open source community by HPDC, L.P.
23
+
24
+ ## Install
25
+
26
+ sudo gem install zookeeper
27
+
28
+ ## Usage
29
+
30
+ Connect to a server:
31
+
32
+ require 'rubygems'
33
+ require 'zookeeper'
34
+ z = Zookeeper.new("localhost:2181")
35
+ z.get_children(:path => "/")
36
+
37
+ ## Idioms
38
+
39
+ The following methods are initially supported:
40
+ * `get`
41
+ * `set`
42
+ * `get_children`
43
+ * `stat`
44
+ * `create`
45
+ * `delete`
46
+ * `get_acl`
47
+ * `set_acl`
48
+
49
+ All support async callbacks. `get`, `get_children` and `stat` support both watchers and callbacks.
50
+
51
+ Calls take a dictionary of parameters. With the exception of set\_acl, the only required parameter is `:path`. Each call returns a dictionary with at minimum two keys :req\_id and :rc.
52
+
53
+ ### A Bit about this repository ###
54
+
55
+ Twitter's open source office was kind enough to transfer this repository to facilitate development and administration of this repository. The `zookeeper` gem's last three releases were recorded in branches `v0.4.2`, `v0.4.3` and `v0.4.4`. Releases of the `slyphon-zookeeper` gem were cut off of the fork, and unfortunately (due to an oversight on my part) were tagged with unrelated versions. Those were tagged with names `release/0.9.2`.
56
+
57
+ The plan is to keep the `slyphon-zookeeper` tags, and to tag the `zookeeper` releases `twitter/release/0.4.x`.
58
+
59
+ Further work will be carried out on this repository. The `0.9.3` release of the zookeeper gem will be released under the 'zookeeper' name, and will bring the two divergent (conceptual) branches of development together.
60
+
61
+
62
+