officer 0.3.1 → 0.3.2
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.
- data/README.markdown +3 -2
- data/VERSION +1 -1
- data/lib/officer/client.rb +2 -3
- data/lib/officer/lock_store.rb +0 -1
- data/officer.gemspec +2 -2
- metadata +2 -2
data/README.markdown
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# Officer - Distributed Lock Server and Client
|
2
2
|
|
3
|
-
This project is a work in progress and shouldn't be considered production ready at this time.
|
4
3
|
It is implemented using Ruby and Eventmachine. Inspiration comes from [elock](http://github.com/dustin/elock).
|
5
4
|
|
6
5
|
## Installation
|
@@ -31,7 +30,7 @@ It is implemented using Ruby and Eventmachine. Inspiration comes from [elock](ht
|
|
31
30
|
|
32
31
|
### Unlock
|
33
32
|
|
34
|
-
client.unlock 'some_lock_name
|
33
|
+
client.unlock 'some_lock_name'
|
35
34
|
|
36
35
|
### Wrap a block of code in a lock/unlock (with optional 5 second timeout)
|
37
36
|
|
@@ -47,6 +46,8 @@ It is implemented using Ruby and Eventmachine. Inspiration comes from [elock](ht
|
|
47
46
|
|
48
47
|
client.reconnect
|
49
48
|
|
49
|
+
- Useful if you use Officer with Phusion Passenger and smart spawning. See [Passenger's documentation](http://www.modrails.com/documentation/Users%20guide%20Apache.html#_smart_spawning_gotcha_1_unintential_file_descriptor_sharing) for more information.
|
50
|
+
|
50
51
|
## Planned Features
|
51
52
|
|
52
53
|
- Lock statistics.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.2
|
data/lib/officer/client.rb
CHANGED
@@ -9,7 +9,6 @@ module Officer
|
|
9
9
|
|
10
10
|
class GenericError < RuntimeError; end
|
11
11
|
class AlreadyConnectedError < GenericError; end
|
12
|
-
class NotConnectedError < GenericError; end
|
13
12
|
class LockError < GenericError; end
|
14
13
|
class LockTimeoutError < LockError; end
|
15
14
|
class UnlockError < GenericError; end
|
@@ -68,8 +67,6 @@ module Officer
|
|
68
67
|
end
|
69
68
|
|
70
69
|
def disconnect
|
71
|
-
raise NotConnectedError unless @socket
|
72
|
-
|
73
70
|
@socket.close
|
74
71
|
@socket = nil
|
75
72
|
end
|
@@ -78,6 +75,8 @@ module Officer
|
|
78
75
|
@socket.write command + "\n"
|
79
76
|
result = @socket.gets "\n"
|
80
77
|
JSON.parse result.chomp
|
78
|
+
rescue
|
79
|
+
reconnect and raise
|
81
80
|
end
|
82
81
|
end
|
83
82
|
|
data/lib/officer/lock_store.rb
CHANGED
data/officer.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{officer}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Chad Remesch"]
|
12
|
-
s.date = %q{2010-02-
|
12
|
+
s.date = %q{2010-02-10}
|
13
13
|
s.default_executable = %q{officer}
|
14
14
|
s.description = %q{Distributed lock server and client written in Ruby and EventMachine}
|
15
15
|
s.email = %q{chad@remesch.com}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: officer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chad Remesch
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-02-
|
12
|
+
date: 2010-02-10 00:00:00 -05:00
|
13
13
|
default_executable: officer
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|