. * */ namespace OCP\Files; /** * Class Lock * @package OC\Files */ interface Lock { const READ = 1; const WRITE = 2; /** * Constructor for the lock instance * @param string $path Absolute pathname for a local file on which to obtain a lock */ public function __construct($path); /** * Add a lock of a specific type to the stack * @param integer $lockType A constant representing the type of lock to queue * @param null|resource $existingHandle An existing file handle from an fopen() * @throws LockNotAcquiredException */ public function addLock($lockType, $existingHandle = null); /** * Release locks on handles and files */ public function release($lockType); /** * Get the lock file associated to a file * @param string $filename The filename of the file to create a lock file for * @return string The filename of the lock file */ public static function getLockFile($filename); /** * Release all queued locks on the file * @return bool */ public function releaseAll(); }