zk 1.7.4 → 1.7.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +1 -1
- data/RELEASES.markdown +4 -0
- data/lib/zk/locker/locker_base.rb +14 -2
- data/lib/zk/version.rb +1 -1
- data/zk.gemspec +1 -1
- metadata +7 -7
data/README.markdown
CHANGED
@@ -25,7 +25,7 @@ Development is sponsored by [Snapfish][] and has been generously released to the
|
|
25
25
|
|
26
26
|
ZooKeeper is a multi-purpose tool that is designed to allow you to write code that coordinates many nodes in a cluster. It can be used as a directory service, a configuration database, and can provide cross-cluster [locking][], [leader election][], and [group membership][] (to name a few). It presents to the user what looks like a distributed file system, with a few important differences: every node can have children _and_ data, and there is a 1MB limit on data size for any given node. ZooKeeper provides atomic semantics and a simple API for manipulating data in the heirarchy.
|
27
27
|
|
28
|
-
One of the most useful aspects of ZooKeeper is the ability to set "[watches][]" on nodes. This allows one to be notified when a node has been deleted, created,
|
28
|
+
One of the most useful aspects of ZooKeeper is the ability to set "[watches][]" on nodes. This allows one to be notified when a node has been deleted, created, changed, or has had its list of child znodes modified. The asynchronous nature of these watches enables you to write code that can _react_ to changes in your environment without polling and busy-waiting.
|
29
29
|
|
30
30
|
Znodes can be _ephemeral_, which means that when the connection that created them goes away, they're automatically cleaned up, and all the clients that were watching them are notified of the deletion. This is an incredibly useful mechanism for providing _presence_ in a cluster ("which of my thingamabobers are up?). If you've ever run across a stale pid file or lock, you can imagine how useful this feature can be.
|
31
31
|
|
data/RELEASES.markdown
CHANGED
@@ -327,8 +327,10 @@ module ZK
|
|
327
327
|
#
|
328
328
|
def create_lock_path!(prefix='lock')
|
329
329
|
@mutex.synchronize do
|
330
|
-
|
331
|
-
|
330
|
+
unless lock_path_exists?
|
331
|
+
@lock_path = @zk.create("#{root_lock_path}/#{prefix}", :mode => :ephemeral_sequential)
|
332
|
+
@parent_stat = @zk.stat(root_lock_path)
|
333
|
+
end
|
332
334
|
end
|
333
335
|
|
334
336
|
logger.debug { "got lock path #{@lock_path}" }
|
@@ -338,6 +340,16 @@ module ZK
|
|
338
340
|
retry
|
339
341
|
end
|
340
342
|
|
343
|
+
# if we previously had a lock path, check if it still exists
|
344
|
+
#
|
345
|
+
def lock_path_exists?
|
346
|
+
@mutex.synchronize do
|
347
|
+
return false unless @lock_path
|
348
|
+
return false unless root_lock_path_same?
|
349
|
+
zk.exists?(@lock_path)
|
350
|
+
end
|
351
|
+
end
|
352
|
+
|
341
353
|
# if the root_lock_path has the same stat .ctime as the one
|
342
354
|
# we cached when we created our lock path, then we can be sure
|
343
355
|
# that we actually own the lock_path
|
data/lib/zk/version.rb
CHANGED
data/zk.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.summary = %q{A high-level wrapper around the zookeeper driver}
|
13
13
|
s.description = s.summary + "\n"
|
14
14
|
|
15
|
-
s.add_runtime_dependency 'zookeeper', '~> 1.
|
15
|
+
s.add_runtime_dependency 'zookeeper', '~> 1.4.0'
|
16
16
|
s.add_runtime_dependency 'logging', '~> 1.7.2'
|
17
17
|
|
18
18
|
s.files = `git ls-files`.split("\n")
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 7
|
9
|
-
-
|
10
|
-
version: 1.7.
|
9
|
+
- 5
|
10
|
+
version: 1.7.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jonathan D. Simms
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2012-
|
19
|
+
date: 2012-12-20 00:00:00 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: zookeeper
|
@@ -26,12 +26,12 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
29
|
+
hash: 7
|
30
30
|
segments:
|
31
31
|
- 1
|
32
|
-
-
|
32
|
+
- 4
|
33
33
|
- 0
|
34
|
-
version: 1.
|
34
|
+
version: 1.4.0
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id001
|
37
37
|
- !ruby/object:Gem::Dependency
|