Part of bzrlib.lockable_files View In Hierarchy
Known subclasses: bzrlib.remote.RemoteBranchLockableFiles
This coordinates access to the lock along with providing a transaction.
LockableFiles manage a lock count and can be locked repeatedly by a single caller. (The underlying lock implementation generally does not support this.)
Instances of this class are often called control_files.
This class is now deprecated; code should move to using the Transport directly for file operations and using the lock or CountedLock for locking.
Instance Variables | _lock | The real underlying lock (e.g. a LockDir) |
_lock_count | If _lock_mode is true, a positive count of the number of times the lock has been taken (and not yet released) by this process, through this particular object instance. | |
_lock_mode | None, or 'r' or 'w' |
Method | __init__ | Create a LockableFiles group |
Method | create_lock | Create the lock. |
Method | __repr__ | Undocumented |
Method | __str__ | Undocumented |
Method | break_lock | Break the lock of this lockable files group if it is held. |
Method | leave_in_place | Set this LockableFiles to not clear the physical lock on unlock. |
Method | dont_leave_in_place | Set this LockableFiles to clear the physical lock on unlock. |
Method | lock_write | Lock this group of files for writing. |
Method | lock_read | Undocumented |
Method | unlock | Undocumented |
Method | is_locked | Return true if this LockableFiles group is locked |
Method | get_physical_lock_status | Return physical lock status. |
Method | get_transaction | Return the current active transaction. |
Method | _escape | DEPRECATED: Do not use outside this class |
Method | _find_modes | Determine the appropriate modes for files and directories. |
Method | _set_read_transaction | Setup a read transaction. |
Method | _set_write_transaction | Setup a write transaction. |
Method | _set_transaction | Set a new active transaction. |
Method | _finish_transaction | Exit the current transaction. |
Parameters | transport | Transport pointing to the directory holding the control files and lock. |
lock_name | Name of the lock guarding these files. | |
lock_class | Class of lock strategy to use: typically either LockDir or TransportLock. |
This should normally be called only when the LockableFiles directory is first created on disk.
The current ui factory will be used to prompt for user conformation.
Unknown Field: deprecated | Replaced by BzrDir._find_creation_modes. |
A token should be passed in if you know that you have locked the object some other way, and need to synchronise this object's state with that fact.
Parameters | token | if this is already locked, then lock_write will fail unless the token matches the existing lock. |
Returns | a token if this instance supports tokens, otherwise None. | |
Raises | TokenLockingNotSupported | when a token is given but this instance doesn't support using token locks. |
MismatchedToken | if the specified token doesn't match the token of the existing lock. |
Returns true if a lock is held on the transport. If no lock is held, or the underlying locking mechanism does not support querying lock status, false is returned.