AutoscanDirectory Class Reference

Provides information about one autoscan directory. More...

#include <autoscan.h>

Inheritance diagram for AutoscanDirectory:
zmm::Object

Public Member Functions

 AutoscanDirectory ()
 AutoscanDirectory (zmm::String location, scan_mode_t mode, scan_level_t level, bool recursive, bool persistent, int id=INVALID_SCAN_ID, unsigned int interval=0, bool hidden=false)
 Creates a new AutoscanDirectory object.
void setStorageID (int storageID)
int getStorageID ()
void setLocation (zmm::String location)
 The location can only be set once!
zmm::String getLocation ()
scan_mode_t getScanMode ()
void setScanMode (scan_mode_t mode)
scan_level_t getScanLevel ()
void setScanLevel (scan_level_t level)
bool getRecursive ()
void setHidden (bool hidden)
bool getHidden ()
void setRecursive (bool recursive)
unsigned int getInterval ()
void setInterval (unsigned int interval)
void incTaskCount ()
 Increments the task count.
void decTaskCount ()
int getTaskCount ()
void setTaskCount (int taskCount)
void setScanID (int id)
 Sets the task ID.
int getScanID ()
void setObjectID (int id)
int getObjectID ()
bool persistent ()
void setCurrentLMT (time_t lmt)
 Sets the last modification time of the current ongoing scan.
time_t getPreviousLMT ()
void updateLMT ()
void resetLMT ()
void copyTo (zmm::Ref< AutoscanDirectory > copy)
 copies all properties to another object
zmm::Ref< zmm::ObjectgetTimerParameter ()
 Set the parameter for timer notify that is associated with the particular autoscan directory.
void retain ()
void release ()
int getRefCount ()

Static Public Member Functions

static zmm::String mapScanmode (scan_mode_t scanmode)
static scan_mode_t remapScanmode (zmm::String scanmode)
static zmm::String mapScanlevel (scan_level_t scanlevel)
static scan_level_t remapScanlevel (zmm::String scanlevel)
static void * operator new (size_t size)
static void operator delete (void *ptr)

Protected Attributes

zmm::String location
scan_mode_t mode
scan_level_t level
bool recursive
bool hidden
bool persistent_flag
unsigned int interval
int taskCount
int scanID
int objectID
int storageID
time_t last_mod_previous_scan
time_t last_mod_current_scan
zmm::Ref< zmm::Objecttimer_parameter
mt_atomic_t _ref_count
pthread_mutex_t mutex

Detailed Description

Provides information about one autoscan directory.

Definition at line 133 of file autoscan.h.


Constructor & Destructor Documentation

AutoscanDirectory::AutoscanDirectory (  ) 
AutoscanDirectory::AutoscanDirectory ( zmm::String  location,
scan_mode_t  mode,
scan_level_t  level,
bool  recursive,
bool  persistent,
int  id = INVALID_SCAN_ID,
unsigned int  interval = 0,
bool  hidden = false 
)

Creates a new AutoscanDirectory object.

Parameters:
location autoscan path
mode scan mode
level scan level
recursive process directories recursively
interval rescan interval in seconds (only for timed scan mode)
hidden include hidden files zero means none.

Definition at line 52 of file autoscan.cc.

References ContentManager::TimerParameter::IDAutoscan, INVALID_OBJECT_ID, INVALID_SCAN_ID, last_mod_current_scan, last_mod_previous_scan, objectID, persistent_flag, scanID, storageID, taskCount, and timer_parameter.


Member Function Documentation

void AutoscanDirectory::copyTo ( zmm::Ref< AutoscanDirectory copy  ) 

copies all properties to another object

Definition at line 426 of file autoscan.cc.

References hidden, interval, last_mod_current_scan, last_mod_previous_scan, level, location, mode, objectID, persistent_flag, recursive, scanID, storageID, taskCount, and timer_parameter.

void AutoscanDirectory::decTaskCount (  )  [inline]

Definition at line 190 of file autoscan.h.

References taskCount.

bool AutoscanDirectory::getHidden (  )  [inline]

Definition at line 172 of file autoscan.h.

References hidden.

unsigned int AutoscanDirectory::getInterval (  )  [inline]

Definition at line 176 of file autoscan.h.

References interval.

zmm::String AutoscanDirectory::getLocation (  )  [inline]

Definition at line 158 of file autoscan.h.

Referenced by WebAutoscanProcessListComparator().

int AutoscanDirectory::getObjectID (  )  [inline]

Definition at line 207 of file autoscan.h.

References objectID.

time_t AutoscanDirectory::getPreviousLMT (  )  [inline]

Definition at line 221 of file autoscan.h.

References last_mod_previous_scan.

bool AutoscanDirectory::getRecursive (  )  [inline]

Definition at line 168 of file autoscan.h.

int Object::getRefCount (  )  [inherited]

Definition at line 78 of file object.cc.

References zmm::Object::_ref_count, and atomic_get().

int AutoscanDirectory::getScanID (  )  [inline]

Definition at line 203 of file autoscan.h.

References scanID.

scan_level_t AutoscanDirectory::getScanLevel (  )  [inline]

Definition at line 164 of file autoscan.h.

scan_mode_t AutoscanDirectory::getScanMode (  )  [inline]

Definition at line 160 of file autoscan.h.

int AutoscanDirectory::getStorageID (  )  [inline]

Definition at line 153 of file autoscan.h.

References storageID.

int AutoscanDirectory::getTaskCount (  )  [inline]

Definition at line 192 of file autoscan.h.

References taskCount.

Ref< Object > AutoscanDirectory::getTimerParameter (  ) 

Set the parameter for timer notify that is associated with the particular autoscan directory.

Get the timer notify parameter associated with this directory.

Definition at line 451 of file autoscan.cc.

References timer_parameter.

void AutoscanDirectory::incTaskCount (  )  [inline]

Increments the task count.

When recursive autoscan is in progress, we only want to subcribe to a timer event when the scan is finished. However, recursive scans spawn tasks for each directory. When adding a rescan task for subdirectories, the taskCount will be incremented. When a task is done the count will be decremented. When timer gets to zero, we will resubscribe.

Definition at line 188 of file autoscan.h.

References taskCount.

String AutoscanDirectory::mapScanlevel ( scan_level_t  scanlevel  )  [static]
String AutoscanDirectory::mapScanmode ( scan_mode_t  scanmode  )  [static]
void Object::operator delete ( void *  ptr  )  [static, inherited]

Definition at line 87 of file object.cc.

References FREE.

void * Object::operator new ( size_t  size  )  [static, inherited]

Definition at line 83 of file object.cc.

References MALLOC.

bool AutoscanDirectory::persistent (  )  [inline]

Definition at line 209 of file autoscan.h.

References persistent_flag.

void Object::release (  )  [inherited]
scan_level_t AutoscanDirectory::remapScanlevel ( zmm::String  scanlevel  )  [static]

Definition at line 416 of file autoscan.cc.

References _, _Exception, BasicScanLevel, and FullScanLevel.

Referenced by SQLStorage::_fillAutoscanDirectory(), and web::autoscan::process().

scan_mode_t AutoscanDirectory::remapScanmode ( zmm::String  scanmode  )  [static]

Definition at line 393 of file autoscan.cc.

References _, _Exception, InotifyScanMode, and TimedScanMode.

Referenced by SQLStorage::_fillAutoscanDirectory(), and web::autoscan::process().

void AutoscanDirectory::resetLMT (  )  [inline]

Definition at line 225 of file autoscan.h.

References last_mod_current_scan, and last_mod_previous_scan.

void Object::retain (  )  [inherited]
void AutoscanDirectory::setCurrentLMT ( time_t  lmt  ) 

Sets the last modification time of the current ongoing scan.

When doing a FullScan we look at modification times of the files. During the recursion of one AutoscanDirectory (which will be the starting point and which may have subcontainers) we must compare the last modification time of the starting point but we may not overwrite it until we are done. The time will be only set if it is higher than the previous value!

Definition at line 72 of file autoscan.cc.

References last_mod_current_scan.

void AutoscanDirectory::setHidden ( bool  hidden  )  [inline]

Definition at line 170 of file autoscan.h.

void AutoscanDirectory::setInterval ( unsigned int  interval  )  [inline]

Definition at line 178 of file autoscan.h.

void AutoscanDirectory::setLocation ( zmm::String  location  ) 

The location can only be set once!

Definition at line 364 of file autoscan.cc.

References _, _Exception, and nil.

void AutoscanDirectory::setObjectID ( int  id  )  [inline]

Definition at line 205 of file autoscan.h.

References objectID.

void AutoscanDirectory::setRecursive ( bool  recursive  )  [inline]

Definition at line 174 of file autoscan.h.

void AutoscanDirectory::setScanID ( int  id  ) 

Sets the task ID.

The task ID helps us to identify to which scan a particular task belongs. Recursive scans spawn new tasks - they all should have the same id.

Definition at line 373 of file autoscan.cc.

References RefCast, scanID, and timer_parameter.

void AutoscanDirectory::setScanLevel ( scan_level_t  level  )  [inline]

Definition at line 166 of file autoscan.h.

void AutoscanDirectory::setScanMode ( scan_mode_t  mode  )  [inline]

Definition at line 162 of file autoscan.h.

void AutoscanDirectory::setStorageID ( int  storageID  )  [inline]

Definition at line 151 of file autoscan.h.

void AutoscanDirectory::setTaskCount ( int  taskCount  )  [inline]

Definition at line 194 of file autoscan.h.

void AutoscanDirectory::updateLMT (  )  [inline]

Definition at line 223 of file autoscan.h.

References last_mod_current_scan, and last_mod_previous_scan.


Field Documentation

mt_atomic_t zmm::Object::_ref_count [protected, inherited]
bool AutoscanDirectory::hidden [protected]

Definition at line 250 of file autoscan.h.

Referenced by copyTo(), and getHidden().

unsigned int AutoscanDirectory::interval [protected]

Definition at line 252 of file autoscan.h.

Referenced by copyTo(), and getInterval().

Definition at line 258 of file autoscan.h.

Referenced by AutoscanDirectory(), copyTo(), resetLMT(), setCurrentLMT(), and updateLMT().

Definition at line 257 of file autoscan.h.

Referenced by AutoscanDirectory(), copyTo(), getPreviousLMT(), resetLMT(), and updateLMT().

Definition at line 248 of file autoscan.h.

Referenced by copyTo().

Definition at line 246 of file autoscan.h.

Referenced by copyTo().

Definition at line 247 of file autoscan.h.

Referenced by copyTo().

pthread_mutex_t zmm::Object::mutex [protected, inherited]
int AutoscanDirectory::objectID [protected]

Definition at line 255 of file autoscan.h.

Referenced by AutoscanDirectory(), copyTo(), getObjectID(), and setObjectID().

Definition at line 251 of file autoscan.h.

Referenced by AutoscanDirectory(), copyTo(), and persistent().

bool AutoscanDirectory::recursive [protected]

Definition at line 249 of file autoscan.h.

Referenced by copyTo().

int AutoscanDirectory::scanID [protected]

Definition at line 254 of file autoscan.h.

Referenced by AutoscanDirectory(), copyTo(), getScanID(), and setScanID().

Definition at line 256 of file autoscan.h.

Referenced by AutoscanDirectory(), copyTo(), and getStorageID().

Definition at line 253 of file autoscan.h.

Referenced by AutoscanDirectory(), copyTo(), decTaskCount(), getTaskCount(), and incTaskCount().

Definition at line 259 of file autoscan.h.

Referenced by AutoscanDirectory(), copyTo(), getTimerParameter(), and setScanID().


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

Generated on Fri Mar 26 20:16:55 2010 for MediaTomb by  doxygen 1.6.1