ldas-tools-diskcacheAPI
2.5.6
|
Directory caching scheme. More...
#include <Directory.hh>
Classes | |
class | FileCacheError |
Exception thrown when a file could not be added to a cache. More... | |
class | ScanResults |
class | StartIsNotADirectoryError |
The top most entry is not a directory. More... | |
class | SymbolicLinkError |
Report symbolic links as errors. More... | |
Public Types | |
enum | { MODIFIED_RESET, MODIFIED_NEW_DIRECTORY, MODIFIED_OFFLINE } |
enum | file_type { UNKNOWN_TYPE, FILE_TYPE, DIRECTORY_TYPE } |
enum | directory_state { DIRECTORY_NEW, DIRECTORY_UPDATED, DIRECTORY_REMOVED, DIRECTORY_OFFLINE } |
typedef LDASTools::AL::SharedPtr < Directory > | dirref_type |
typedef INT_4U | size_type |
typedef INT_4U | timestamp_type |
typedef std::set< std::string > | children_type |
typedef std::set< std::string > | ignored_type |
typedef RegistrySingleton::id_type | search_id_type |
typedef LDASTools::AL::SharedPtr < Streams::Streamable > | search_data_type |
typedef LDASTools::AL::unordered_map < search_id_type, search_data_type > | index_container_type |
typedef std::list< std::string > | excluded_directories_type |
typedef LDASTools::AL::ReadWriteLockVariable < LDASTools::AL::ReadWriteLock::WRITE, excluded_directories_type > | excluded_directories_rw_type |
typedef LDASTools::AL::ReadWriteLockVariable < LDASTools::AL::ReadWriteLock::READ, excluded_directories_type > | excluded_directories_ro_type |
Public Member Functions | |
Directory () | |
Default Constructor. More... | |
Directory (const std::string &Path, const std::string &Root) | |
Constructor with a directory path. More... | |
Directory (const std::string &Path, dirref_type Parent) | |
Constructor with a directory path and parent. More... | |
virtual | ~Directory () |
Destructor. More... | |
void | AddSubdirectory (dirref_type Dir) |
template<typename Op > | |
void | Children (Op &Operation) const |
Iterate over the collection of subdirectories. More... | |
template<typename Op > | |
void | ChildrenReverse (Op &Operation) const |
Reverse iterate over the collection of subdirectories. More... | |
virtual bool | Configure (const std::string &Variable, const std::string &Value) |
Allow for customization. More... | |
size_type | DirectoryCount () const |
void | Find (QueryAnswer &Answer) const |
Find a collection of files. More... | |
size_type | FileCount () const |
const std::string & | Fullname () const |
Return the fully qualified name of the directory. More... | |
bool | IsRoot () const |
Return true if this object represents a root directory. More... | |
bool | IsOffline () const |
Return true if the directory is offline. More... | |
const std::string & | Name () const |
Return the relative name of the directory. More... | |
template<typename StreamT > | |
StreamT & | Read (StreamT &Stream) |
Read the common information from a stream. More... | |
const std::string & | Root () const |
Retrieve the directory where this tree is rooted. More... | |
dirref_type | Scan (DirectoryManager &DirectoryCollection, ScanResults &Results, const std::string &Caller, const std::string &JobInfo) const |
Scan current directory directory. More... | |
timestamp_type | TimeModified () const |
Report the last time the directory had been modified. More... | |
template<typename StreamT > | |
StreamT & | Write (StreamT &Stream) const |
Write the information out to a stream. More... | |
template<> | |
OASCII & | Write (OASCII &Stream) const |
template<> | |
IBinary & | Read (IBinary &Stream) |
template<> | |
OBinary & | Write (OBinary &Stream) const |
Static Public Member Functions | |
static const excluded_directories_ro_type | ExcludedDirectories () |
Obtain patterns of directories to exclude. More... | |
static void | ExcludedDirectories (excluded_directories_type &Dirs) |
Modify the list of directories to be excluded. More... | |
Protected Member Functions | |
LDASTools::AL::SharedPtr < Directory > | parent () const |
Return the parent associated with this directory. More... | |
const children_type & | children () const |
Retrieve the set of children. More... | |
search_data_type | searchData (search_id_type Key) |
Friends | |
class | functor_reset |
Directory caching scheme.
This caching scheme is for the caching of directory information. It is not used directly by end users to search for files, but instead is used as the driver for detecting changes to the file system and causing search caches to be updated.
typedef std::set< std::string > diskCache::Cache::Directory::children_type |
typedef LDASTools::AL::SharedPtr< Directory > diskCache::Cache::Directory::dirref_type |
typedef LDASTools::AL::ReadWriteLockVariable< LDASTools::AL::ReadWriteLock::READ, excluded_directories_type > diskCache::Cache::Directory::excluded_directories_ro_type |
typedef LDASTools::AL::ReadWriteLockVariable< LDASTools::AL::ReadWriteLock::WRITE, excluded_directories_type > diskCache::Cache::Directory::excluded_directories_rw_type |
typedef std::list< std::string > diskCache::Cache::Directory::excluded_directories_type |
typedef std::set< std::string > diskCache::Cache::Directory::ignored_type |
typedef LDASTools::AL::unordered_map< search_id_type, search_data_type > diskCache::Cache::Directory::index_container_type |
typedef LDASTools::AL::SharedPtr< Streams::Streamable > diskCache::Cache::Directory::search_data_type |
typedef INT_4U diskCache::Cache::Directory::size_type |
typedef INT_4U diskCache::Cache::Directory::timestamp_type |
anonymous enum |
Enumerator | |
---|---|
MODIFIED_RESET |
Directory needs to be rescanned. This state is useful for flagging a single directory for rescanning. Some examples of when a directory would be flagged in this manor would be the:
|
MODIFIED_NEW_DIRECTORY |
Directory has been newly created. When a directory is first seen, it is given this state. This allows for some optimization as it does not need to Calculate any differences. |
MODIFIED_OFFLINE |
A timeout occured during reading. This error indicates that a directory or subdirectory received a timeout error condition during a scan. The mount point was flagged as being offline and flagged with this state. Once the mount point becomes available, the entire mount point is rescanned. |
diskCache::Cache::Directory::Directory | ( | ) |
Default Constructor.
diskCache::Cache::Directory::Directory | ( | const std::string & | Path, |
const std::string & | Root | ||
) |
Constructor with a directory path.
[in] | Path | The fully qualified path. |
[in] | Root | The root directory |
diskCache::Cache::Directory::Directory | ( | const std::string & | Path, |
dirref_type | Parent | ||
) |
Constructor with a directory path and parent.
[in] | Path | The fully qualified path. |
[in] | Parent | The parent of this node |
|
virtual |
Destructor.
|
inline |
|
inline |
Iterate over the collection of subdirectories.
[out] | Operation | This is the action that should be taken for each subdirectory. |
|
inlineprotected |
Retrieve the set of children.
Retrieve a collection of directories that are children of this directory.
|
inline |
Reverse iterate over the collection of subdirectories.
[out] | Operation | This is the action that should be taken for each subdirectory. |
|
virtual |
Allow for customization.
[in] | Variable | Name of the option to modify |
[in] | Value | The ascii string representation of the value for the option. |
Configuration of the directory cache understands the following variables:
|
inline |
|
inlinestatic |
Obtain patterns of directories to exclude.
|
inlinestatic |
Modify the list of directories to be excluded.
[in,out] | Dirs | The list of new directories to be excluded. The list passed by this variable will be swapped with the current list of directories to be excluded. |
|
inline |
void diskCache::Cache::Directory::Find | ( | QueryAnswer & | Answer | ) | const |
Find a collection of files.
[in] | Answer | Local storage for query and answer. |
|
inline |
Return the fully qualified name of the directory.
Retieve the fully pathed name for the requested directory. This is achieved by walking up the geneology until the root node.
|
inline |
Return true if the directory is offline.
|
inline |
Return true if this object represents a root directory.
|
inline |
Return the relative name of the directory.
The relative name is simple the name associated with this directory information as referenced by its parent. A root directory name must be fully qualified.
|
protected |
Return the parent associated with this directory.
IBinary& diskCache::Cache::Directory::Read | ( | IBinary & | Stream | ) |
Initialize the memory contents from the stream. This reads the contents for a single directory.
StreamT& diskCache::Cache::Directory::Read | ( | StreamT & | Stream | ) |
Read the common information from a stream.
|
inline |
Retrieve the directory where this tree is rooted.
The root name is the name of the node that appears highest in the tree. Taking any node as a start, the tree is assended until the one with no parent is reached. It is the name of this node which is returned.
Directory::dirref_type diskCache::Cache::Directory::Scan | ( | DirectoryManager & | DirectoryCollection, |
ScanResults & | Results, | ||
const std::string & | Caller, | ||
const std::string & | JobInfo | ||
) | const |
Scan current directory directory.
|
inlineprotected |
|
inline |
Report the last time the directory had been modified.
OASCII& diskCache::Cache::Directory::Write | ( | OASCII & | Stream | ) | const |
NOTE: This currently only dumps the SDTx information
OBinary& diskCache::Cache::Directory::Write | ( | OBinary & | Stream | ) | const |
StreamT& diskCache::Cache::Directory::Write | ( | StreamT & | Stream | ) | const |
Write the information out to a stream.
|
friend |