Package oauth2client :: Module locked_file |
[hide private]
[frames] | no frames]

# Module locked_file

source code

    Locked file interface that should work on Unix and Windows pythons.

    This module first tries to use fcntl locking to ensure serialized access
    to a file, then falls back on a lock file if that is unavialable.

    Usage:
        f = LockedFile('filename', 'r+b', 'rb')
        f.open_and_lock()
        if f.is_locked():
          print 'Acquired filename with r+b mode'
          f.file_handle().write('locked data')
        else:
          print 'Aquired filename with rb mode'
        f.unlock_and_close()

Author: cache@google.com (David T McWherter)

Classes | [hide private]
| CredentialsFileSymbolicLinkError Credentials files must not be symbolic links.
| AlreadyLockedException Trying to lock a file that has already been locked by the LockedFile.
| _Opener Base class for different locking primitives.
| _PosixOpener Lock files using Posix advisory lock files.
| LockedFile Represent a file that has exclusive access.

Functions | [hide private]
validate_file(filename) | source code

Variables | [hide private]
| logger = `logging.getLogger(__name__)`
| _FcntlOpener = `None`
| _Win32Opener = `None`