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

Class _PosixOpener

source code


Lock files using Posix advisory lock files.

Instance Methods [hide private]
 
open_and_lock(self, timeout, delay)
Open the file and lock it.
source code
 
unlock_and_close(self)
Unlock a file by removing the .lock file, and close the handle.
source code
 
_posix_lockfile(self, filename)
The name of the lock file to use for posix locking.
source code

Inherited from _Opener: __init__, file_handle, filename, is_locked

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

open_and_lock(self, timeout, delay)

source code 
Open the file and lock it.

Tries to create a .lock file next to the file we're trying to open.

Args:
  timeout: float, How long to try to lock for.
  delay: float, How long to wait between retries.

Raises:
  AlreadyLockedException: if the lock is already acquired.
  IOError: if the open fails.
  CredentialsFileSymbolicLinkError if the file is a symbolic link.

Overrides: _Opener.open_and_lock

unlock_and_close(self)

source code 
Unlock a file by removing the .lock file, and close the handle.

Overrides: _Opener.unlock_and_close