Class: RSched::Lock
- Inherits:
-
Object
- Object
- RSched::Lock
- Defined in:
- lib/rsched/lock.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#hostname ⇒ Object
readonly
Returns the value of attribute hostname.
-
#timeout ⇒ Object
readonly
Returns the value of attribute timeout.
Instance Method Summary collapse
-
#acquire(ident, time, now = Time.now.to_i) ⇒ Object
acquired=token, locked=false, finished=nil.
- #delete_before(ident, time) ⇒ Object
- #extend_timeout(token, timeout = Time.now.to_i+@timeout) ⇒ Object
- #finish(token, now = Time.now.to_i) ⇒ Object
-
#initialize(hostname, timeout) ⇒ Lock
constructor
A new instance of Lock.
- #release(token) ⇒ Object
Constructor Details
#initialize(hostname, timeout) ⇒ Lock
Returns a new instance of Lock.
6 7 8 9 |
# File 'lib/rsched/lock.rb', line 6 def initialize(hostname, timeout) @hostname = hostname @timeout = timeout end |
Instance Attribute Details
#hostname ⇒ Object (readonly)
Returns the value of attribute hostname.
11 12 13 |
# File 'lib/rsched/lock.rb', line 11 def hostname @hostname end |
#timeout ⇒ Object (readonly)
Returns the value of attribute timeout.
11 12 13 |
# File 'lib/rsched/lock.rb', line 11 def timeout @timeout end |
Instance Method Details
#acquire(ident, time, now = Time.now.to_i) ⇒ Object
acquired=token, locked=false, finished=nil
14 15 |
# File 'lib/rsched/lock.rb', line 14 def acquire(ident, time, now=Time.now.to_i) end |
#delete_before(ident, time) ⇒ Object
26 27 |
# File 'lib/rsched/lock.rb', line 26 def delete_before(ident, time) end |
#extend_timeout(token, timeout = Time.now.to_i+@timeout) ⇒ Object
23 24 |
# File 'lib/rsched/lock.rb', line 23 def extend_timeout(token, timeout=Time.now.to_i+@timeout) end |
#finish(token, now = Time.now.to_i) ⇒ Object
20 21 |
# File 'lib/rsched/lock.rb', line 20 def finish(token, now=Time.now.to_i) end |
#release(token) ⇒ Object
17 18 |
# File 'lib/rsched/lock.rb', line 17 def release(token) end |