/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/lock.py

  • Committer: Martin Pool
  • Date: 2008-05-27 02:54:53 UTC
  • mto: (3724.1.1 lock-hooks)
  • mto: This revision was merged to the branch mainline in revision 3730.
  • Revision ID: mbp@sourcefrog.net-20080527025453-g92mkdb1u2aterqe
Move physical lock hooks onto new PhysicalLock class variable

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
from bzrlib.hooks import Hooks
46
46
 
47
47
 
48
 
class PhysicalLockHooks(Hooks):
49
 
    """hooks for physical lock activity."""
50
 
 
51
 
    def __init__(self):
52
 
        """Create the default hooks.
53
 
 
54
 
        There are no default hooks present.
55
 
        """
56
 
        Hooks.__init__(self)
57
 
        # Introduced in 1.4:
58
 
        # invoked when a physical lock has been successfully acquired.
59
 
        self['acquired'] = []
60
 
        # Introduced in 1.5:
61
 
        # invoked when a physical lock has been successfully released.
62
 
        self['released'] = []
63
 
 
64
 
 
65
 
# The hooks instance clients should register against. Do *NOT* import this
66
 
# symbol, always reference it through lock.hooks.
67
 
hooks = PhysicalLockHooks()
 
48
class PhysicalLock(object):
 
49
    """Base class for external on-disk physical locks.
 
50
 
 
51
    At present only LockDir descends from this, but all locks should.
 
52
 
 
53
    :cvar hooks: Hook dictionary for operations on locks.
 
54
    """
 
55
 
 
56
    hooks = Hooks()
 
57
    hooks['acquired'] = []
 
58
    hooks['released'] = []
68
59
 
69
60
 
70
61
class LockResult(object):
 
62
    """Result of an operation on a lock; passed to a hook"""
71
63
 
72
64
    def __init__(self, lock_url, details=None):
73
65
        """Create a lock result for lock with optional details about the lock."""