CernVM-FS  2.12.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
file_watcher::FileWatcher Class Referenceabstract

#include <file_watcher.h>

Inheritance diagram for file_watcher::FileWatcher:

Public Types

typedef std::map< std::string,
EventHandler * > 
HandlerMap
 

Public Member Functions

 FileWatcher ()
 
virtual ~FileWatcher ()
 
void RegisterHandler (const std::string &file_path, EventHandler *handler)
 
bool Spawn ()
 
void Stop ()
 

Static Public Member Functions

static FileWatcherCreate ()
 

Protected Member Functions

void RegisterFilter (const std::string &file_path, EventHandler *handler)
 
virtual bool RunEventLoop (const HandlerMap &handler_map, int read_pipe, int write_pipe)=0
 
virtual int TryRegisterFilter (const std::string &file_path)=0
 

Protected Attributes

std::map< int, WatchRecordwatch_records_
 

Static Protected Attributes

static const unsigned kInitialDelay = 1000
 
static const unsigned kMaxDelay = 10000
 
static const unsigned kResetDelay = 50000
 

Static Private Member Functions

static void * BackgroundThread (void *d)
 

Private Attributes

HandlerMap handler_map_
 
int control_pipe_to_back_ [2]
 
int control_pipe_to_front_ [2]
 
pthread_t thread_
 
bool started_
 

Detailed Description

Definition at line 62 of file file_watcher.h.

Member Typedef Documentation

typedef std::map<std::string, EventHandler*> file_watcher::FileWatcher::HandlerMap

Definition at line 64 of file file_watcher.h.

Constructor & Destructor Documentation

file_watcher::FileWatcher::FileWatcher ( )

Definition at line 34 of file file_watcher.cc.

file_watcher::FileWatcher::~FileWatcher ( )
virtual

Definition at line 40 of file file_watcher.cc.

Here is the call graph for this function:

Member Function Documentation

void * file_watcher::FileWatcher::BackgroundThread ( void *  d)
staticprivate

Definition at line 100 of file file_watcher.cc.

Referenced by Spawn().

Here is the call graph for this function:

Here is the caller graph for this function:

FileWatcher * file_watcher::FileWatcher::Create ( )
static

Definition at line 44 of file file_watcher.cc.

Referenced by MountPoint::CreateResolvConfWatcher().

Here is the caller graph for this function:

void file_watcher::FileWatcher::RegisterFilter ( const std::string &  file_path,
EventHandler handler 
)
protected

Definition at line 112 of file file_watcher.cc.

Referenced by file_watcher::FileWatcherInotify::RunEventLoop(), and file_watcher::FileWatcherKqueue::RunEventLoop().

Here is the call graph for this function:

Here is the caller graph for this function:

void file_watcher::FileWatcher::RegisterHandler ( const std::string &  file_path,
EventHandler handler 
)

Definition at line 56 of file file_watcher.cc.

Referenced by MountPoint::CreateResolvConfWatcher().

Here is the caller graph for this function:

virtual bool file_watcher::FileWatcher::RunEventLoop ( const HandlerMap handler_map,
int  read_pipe,
int  write_pipe 
)
protectedpure virtual

Implemented in file_watcher::FileWatcherInotify, and file_watcher::FileWatcherKqueue.

Referenced by BackgroundThread().

Here is the caller graph for this function:

bool file_watcher::FileWatcher::Spawn ( )

Definition at line 61 of file file_watcher.cc.

Referenced by Spawn().

Here is the call graph for this function:

Here is the caller graph for this function:

void file_watcher::FileWatcher::Stop ( )

Definition at line 81 of file file_watcher.cc.

Referenced by ~FileWatcher(), and MountPoint::~MountPoint().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual int file_watcher::FileWatcher::TryRegisterFilter ( const std::string &  file_path)
protectedpure virtual

Implemented in file_watcher::FileWatcherInotify, and file_watcher::FileWatcherKqueue.

Referenced by RegisterFilter().

Here is the caller graph for this function:

Member Data Documentation

int file_watcher::FileWatcher::control_pipe_to_back_[2]
private

Definition at line 98 of file file_watcher.h.

Referenced by BackgroundThread(), Spawn(), and Stop().

int file_watcher::FileWatcher::control_pipe_to_front_[2]
private

Definition at line 99 of file file_watcher.h.

Referenced by BackgroundThread(), Spawn(), and Stop().

HandlerMap file_watcher::FileWatcher::handler_map_
private

Definition at line 96 of file file_watcher.h.

Referenced by BackgroundThread(), RegisterHandler(), and Stop().

const unsigned file_watcher::FileWatcher::kInitialDelay = 1000
staticprotected

Definition at line 79 of file file_watcher.h.

Referenced by RegisterFilter().

const unsigned file_watcher::FileWatcher::kMaxDelay = 10000
staticprotected

Definition at line 80 of file file_watcher.h.

Referenced by RegisterFilter().

const unsigned file_watcher::FileWatcher::kResetDelay = 50000
staticprotected

Definition at line 81 of file file_watcher.h.

Referenced by RegisterFilter().

bool file_watcher::FileWatcher::started_
private

Definition at line 103 of file file_watcher.h.

Referenced by Spawn(), and Stop().

pthread_t file_watcher::FileWatcher::thread_
private

Definition at line 101 of file file_watcher.h.

Referenced by Spawn(), and Stop().

std::map<int, WatchRecord> file_watcher::FileWatcher::watch_records_
protected

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