dustin-elock-client 0.2 → 0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/elock-client.rb +16 -0
  2. metadata +2 -2
data/lib/elock-client.rb CHANGED
@@ -29,6 +29,22 @@ class ELock
29
29
  do_cmd("unlock_all")
30
30
  end
31
31
 
32
+ # Get server stats
33
+ def stats
34
+ @socket.write("stats\r\n")
35
+ line = @socket.gets("\r\n")
36
+ rv={}
37
+ if line.to_i == 200
38
+ line = @socket.gets("\r\n").strip
39
+ while line != 'END'
40
+ s, name, val=line.split
41
+ rv[name]=val
42
+ line = @socket.gets("\r\n").strip
43
+ end
44
+ end
45
+ rv
46
+ end
47
+
32
48
  # Run a block while holding the named lock.
33
49
  # raises Locked if the lock could not be acquired.
34
50
  def with_lock(name, timeout=nil)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dustin-elock-client
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.2"
4
+ version: "0.3"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Sallings
@@ -48,7 +48,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
48
48
  requirements: []
49
49
 
50
50
  rubyforge_project:
51
- rubygems_version: 1.0.1
51
+ rubygems_version: 1.2.0
52
52
  signing_key:
53
53
  specification_version: 2
54
54
  summary: Ruby client for the elock distributed lock server.