Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
net_instaweb::FileSystemLockManager Class Reference

#include "file_system_lock_manager.h"

Inheritance diagram for net_instaweb::FileSystemLockManager:
net_instaweb::NamedLockManager

Public Member Functions

 FileSystemLockManager (FileSystem *file_system, const StringPiece &base_path, Scheduler *scheduler, MessageHandler *handler)
 
virtual
SchedulerBasedAbstractLock
CreateNamedLock (const StringPiece &name)
 
FileSystemfile_system () const
 Simple accessors for constructor arguments.
 
Schedulerscheduler () const
 
MessageHandlerhandler () const
 

Detailed Description

Use the locking routines in FileSystem to implement named locks. Requires a Scheduler as well because the FileSystem locks are non-blocking and we must deal with blocking until they are available. A MessageHandler is used to report file system errors during lock creation and cleanup.

Constructor & Destructor Documentation

net_instaweb::FileSystemLockManager::FileSystemLockManager ( FileSystem file_system,
const StringPiece &  base_path,
Scheduler scheduler,
MessageHandler handler 
)

Note: a FileSystemLockManager must outlive any and all locks that it creates. It does not assume ownership of the passed-in constructor arguments. (Except it does copy in base_path). The caller is responsible for ensuring that base_path exists.

Member Function Documentation

virtual SchedulerBasedAbstractLock* net_instaweb::FileSystemLockManager::CreateNamedLock ( const StringPiece &  name)
virtual

Multiple lock objects with the same name will manage the same underlying lock. Lock names must be legal file names according to file_system.

A lock created by CreateNamedLock will be Unlocked when it is destructed if the NamedLock object appears to still be locked at destruction time. This attempts to ensure that the file system is not littered with the remnants of dead locks. A given NamedLock object should Lock and Unlock in matched pairs; DO NOT use separate NamedLock objects created with the same name to perform a Lock and the corresponding Unlock.

Implements net_instaweb::NamedLockManager.


The documentation for this class was generated from the following file: