b.l.LockableFiles(object) : class documentation

Part of bzrlib.lockable_files View In Hierarchy

Known subclasses: bzrlib.remote.RemoteBranchLockableFiles

Object representing a set of related files locked within the same scope.

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_lockThe real underlying lock (e.g. a LockDir)
_lock_countIf _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_modeNone, 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.
def __init__(self, transport, lock_name, lock_class):
Create a LockableFiles group
ParameterstransportTransport pointing to the directory holding the control files and lock.
lock_nameName of the lock guarding these files.
lock_classClass of lock strategy to use: typically either LockDir or TransportLock.
def create_lock(self):
Create the lock.

This should normally be called only when the LockableFiles directory is first created on disk.

def __repr__(self):
Undocumented
def __str__(self):
Undocumented
def break_lock(self):
Break the lock of this lockable files group if it is held.

The current ui factory will be used to prompt for user conformation.

def _escape(self, file_or_path):
DEPRECATED: Do not use outside this class
def _find_modes(self):
Determine the appropriate modes for files and directories.
Unknown Field: deprecatedReplaced by BzrDir._find_creation_modes.
def leave_in_place(self):
Set this LockableFiles to not clear the physical lock on unlock.
def dont_leave_in_place(self):
Set this LockableFiles to clear the physical lock on unlock.
def lock_write(self, token=None):
Lock this group of files for writing.

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.

Parameterstokenif this is already locked, then lock_write will fail unless the token matches the existing lock.
Returnsa token if this instance supports tokens, otherwise None.
RaisesTokenLockingNotSupportedwhen a token is given but this instance doesn't support using token locks.
MismatchedTokenif the specified token doesn't match the token of the existing lock.
def lock_read(self):
Undocumented
def _set_read_transaction(self):
Setup a read transaction.
def _set_write_transaction(self):
Setup a write transaction.
@only_raises(errors.LockNotHeld, errors.LockBroken)
def unlock(self):
Undocumented
def is_locked(self):
Return true if this LockableFiles group is locked
def get_physical_lock_status(self):
Return physical lock status.

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.

def get_transaction(self):
Return the current active transaction.

If no transaction is active, this returns a passthrough object for which all data is immediately flushed and no caching happens.

def _set_transaction(self, new_transaction):
Set a new active transaction.
def _finish_transaction(self):
Exit the current transaction.
API Documentation for Bazaar, generated by pydoctor at 2022-06-16 00:25:16.