lib/rsched/lock.rb in rsched-0.2.0 vs lib/rsched/lock.rb in rsched-0.3.0

- old
+ new

@@ -2,19 +2,26 @@ module RSched class Lock def initialize(hostname, timeout) + @hostname = hostname + @timeout = timeout end + attr_reader :hostname, :timeout + # acquired=token, locked=false, finished=nil - def acquire(ident, time) + def acquire(ident, time, now=Time.now.to_i) end - def release(token) + def release(token, next_timeout=Time.now.to_i) end - def finish(token) + def finish(token, now=Time.now.to_i) + end + + def extend_timeout(token, timeout=Time.now.to_i+@timeout) end def delete_before(ident, time) end end