Part of bzrlib.lockdir View In Hierarchy
This information is recorded into the lock when it's taken, and it can be read back by any process with access to the lockdir. It can be used, for example, to tell the user who holds the lock, or to try to detect whether the lock holder is still alive.
Prior to bzr 2.4 a simple dict was used instead of an object.
Method | __init__ | Undocumented |
Method | __repr__ | Return a debugging representation of this object. |
Method | __unicode__ | Return a user-oriented description of this object. |
Method | to_readable_dict | Turn the holder info into a dict of human-readable attributes. |
Method | get | Return the contents of a field from the lock info, or None. |
Class Method | for_this_process | Return a new LockHeldInfo for a lock taken by this process. |
Method | to_bytes | Undocumented |
Class Method | from_info_file_bytes | Construct from the contents of the held file. |
Method | __cmp__ | Value comparison of lock holders. |
Method | is_locked_by_this_process | True if this process seems to be the current lock holder. |
Method | is_lock_holder_known_dead | True if the lock holder process is known to be dead. |
For example, the start time is presented relative to the current time, rather than as seconds since the epoch.
Returns a list of [user, hostname, pid, time_ago] all as readable strings.
False if it's either known to be still alive, or if we just can't tell.
We can be fairly sure the lock holder is dead if it declared the same hostname and there is no process with the given pid alive. If people have multiple machines with the same hostname this may cause trouble.
This doesn't check whether the lock holder is in fact the same process calling this method. (In that case it will return true.)