Liking cljdoc? Tell your friends :D

house.jux--.prevayler-impl5--.write-lease


acquire-for!clj

(acquire-for! dir sleep-interval _on-deposed)

Acquires a virtual, exclusive lease to write on dir. Implementation:

  • Deletes the lock file of the previous owner, if any. Deletes the 'lock' directory in dir.
  • Creates the 'lock' directory atomically (via rename) in dir with our own lock file in it.
  • Starts to periodically refresh the lease (rename our lock file to make sure it still exists). Cooperatively and definitively yields the lease when some other owner deletes our lock file. Returns the lease (an opaque handle) to be used with the other fns in this namespace. Calls on-deposed when we gain knowledge that some other owner (normally a different machine) has taken over the lease.
Acquires a virtual, exclusive lease to write on dir. Implementation:
  - Deletes the lock file of the previous owner, if any. Deletes the 'lock' directory in dir.
  - Creates the 'lock' directory atomically (via rename) in dir with our own lock file in it.
  - Starts to periodically refresh the lease (rename our lock file to make sure it still exists).
Cooperatively and definitively yields the lease when some other owner deletes our lock file.
Returns the lease (an opaque handle) to be used with the other fns in this namespace. 
Calls on-deposed when we gain knowledge that some other owner (normally a different machine) has taken over the lease.
raw docstring

check!clj

(check! my-lease)

Throws an exception with a helpful message in these situations:

  • The lock file has been deleted (normally by another owner taking over).
  • The last attempt to refresh the lease (rename our lock file) has failed and we cannot be certain whether the file still exists or has been deleted.
Throws an exception with a helpful message in these situations:
- The lock file has been deleted (normally by another owner taking over).
- The last attempt to refresh the lease (rename our lock file) has failed and we cannot be certain whether the file still exists or has been deleted.
raw docstring

dirclj

(dir lease)

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close