CernVM-FS
2.12.0
|
A simple recursion engine to abstract the recursion of directories. It provides several callback hooks to instrument and control the recursion. Hooks will be called on the provided delegate object of type T. More...
#include <fs_traversal.h>
Public Types | |
typedef void(T::* | VoidCallback )(const std::string &relative_path, const std::string &dir_name) |
typedef bool(T::* | BoolCallback )(const std::string &relative_path, const std::string &dir_name) |
Public Member Functions | |
FileSystemTraversal (T *delegate, const std::string &relative_to_directory, const bool recurse) | |
void | Recurse (const std::string &dir_path) const |
Private Member Functions | |
void | Init () |
void | DoRecursion (const std::string &parent_path, const std::string &dir_name) const |
bool | Notify (const BoolCallback callback, const std::string &parent_path, const std::string &entry_name) const |
void | Notify (const VoidCallback callback, const std::string &parent_path, const std::string &entry_name) const |
std::string | GetRelativePath (const std::string &absolute_path) const |
Private Attributes | |
T * | delegate_ |
std::string | relative_to_directory_ |
bool | recurse_ |
A simple recursion engine to abstract the recursion of directories. It provides several callback hooks to instrument and control the recursion. Hooks will be called on the provided delegate object of type T.
This file is part of the CernVM File System.
It provides a file system traversal framework to abstract the traversal of directories. Callbacks are called for every directory entry found by the recursion engine. The recursion can be influenced by return values of these callbacks.
Definition at line 37 of file fs_traversal.h.
typedef bool(T::* FileSystemTraversal< T >::BoolCallback)(const std::string &relative_path, const std::string &dir_name) |
Definition at line 41 of file fs_traversal.h.
typedef void(T::* FileSystemTraversal< T >::VoidCallback)(const std::string &relative_path, const std::string &dir_name) |
Definition at line 39 of file fs_traversal.h.
|
inline |
Create a new recursion engine
delegate | The object that will receive the callbacks |
relative_to_directory | The DirEntries will be created relative to this directory |
recurse | Should the traversal engine recurse? (if not, it just traverses the given directory) |
Definition at line 87 of file fs_traversal.h.
|
inlineprivate |
|
inlineprivate |
Definition at line 249 of file fs_traversal.h.
|
inlineprivate |
Definition at line 139 of file fs_traversal.h.
|
inlineprivate |
Definition at line 230 of file fs_traversal.h.
|
inlineprivate |
Definition at line 239 of file fs_traversal.h.
|
inline |
Start the recursion.
dir_path | The directory to start the recursion at |
Definition at line 112 of file fs_traversal.h.
Referenced by swissknife::CommandScrub::Main(), swissknife::CommandGraft::Recurse(), RemoveTree(), publish::SyncUnionAufs::Traverse(), and publish::SyncUnionOverlayfs::Traverse().
|
private |
Definition at line 132 of file fs_traversal.h.
VoidCallback FileSystemTraversal< T >::fn_enter_dir |
Definition at line 45 of file fs_traversal.h.
Referenced by publish::SyncMediator::AddDirectoryRecursively(), swissknife::CommandScrub::Main(), publish::SyncUnionAufs::Traverse(), and publish::SyncUnionOverlayfs::Traverse().
BoolCallback FileSystemTraversal< T >::fn_ignore_file |
Optional callback for all files during recursion to decide whether to completely ignore the file. If this callback returns true then the file will not be processed (this is a replacement for the ignored_files set, and it allows to ignore based on names or something else). If the function is not specified, no files will be ignored (except for "." and "..").
Definition at line 62 of file fs_traversal.h.
Referenced by publish::SyncUnionAufs::Traverse(), and publish::SyncUnionOverlayfs::Traverse().
VoidCallback FileSystemTraversal< T >::fn_leave_dir |
Definition at line 46 of file fs_traversal.h.
Referenced by RemoveTree(), publish::SyncUnionAufs::Traverse(), and publish::SyncUnionOverlayfs::Traverse().
VoidCallback FileSystemTraversal< T >::fn_new_block_dev |
Definition at line 50 of file fs_traversal.h.
Referenced by publish::SyncUnionAufs::Traverse(), and publish::SyncUnionOverlayfs::Traverse().
VoidCallback FileSystemTraversal< T >::fn_new_character_dev |
Definition at line 51 of file fs_traversal.h.
Referenced by RemoveTree(), publish::SyncUnionAufs::Traverse(), and publish::SyncUnionOverlayfs::Traverse().
VoidCallback FileSystemTraversal< T >::fn_new_dir_postfix |
Callback for a found directory after it was already recursed e.g. for deletion of directories: first delete content, then the directory itself
Definition at line 76 of file fs_traversal.h.
BoolCallback FileSystemTraversal< T >::fn_new_dir_prefix |
Callback if a directory was found. Depending on the response of the callback, the recursion will continue in the found directory/ If this callback is not specified, it will recurse by default.
Definition at line 69 of file fs_traversal.h.
Referenced by swissknife::CommandGraft::Recurse(), RemoveTree(), publish::SyncUnionAufs::Traverse(), and publish::SyncUnionOverlayfs::Traverse().
VoidCallback FileSystemTraversal< T >::fn_new_fifo |
Definition at line 52 of file fs_traversal.h.
Referenced by RemoveTree(), publish::SyncUnionAufs::Traverse(), and publish::SyncUnionOverlayfs::Traverse().
VoidCallback FileSystemTraversal< T >::fn_new_file |
Definition at line 47 of file fs_traversal.h.
Referenced by publish::SyncMediator::CompleteHardlinks(), swissknife::CommandScrub::Main(), swissknife::CommandGraft::Recurse(), publish::SyncMediator::RemoveDirectoryRecursively(), RemoveTree(), publish::SyncUnionAufs::Traverse(), and publish::SyncUnionOverlayfs::Traverse().
VoidCallback FileSystemTraversal< T >::fn_new_socket |
Definition at line 49 of file fs_traversal.h.
Referenced by RemoveTree(), publish::SyncUnionAufs::Traverse(), and publish::SyncUnionOverlayfs::Traverse().
VoidCallback FileSystemTraversal< T >::fn_new_symlink |
Definition at line 48 of file fs_traversal.h.
Referenced by swissknife::CommandScrub::Main(), RemoveTree(), publish::SyncUnionAufs::Traverse(), and publish::SyncUnionOverlayfs::Traverse().
|
private |
Definition at line 136 of file fs_traversal.h.
|
private |
dir_path in callbacks will be relative to this directory
Definition at line 135 of file fs_traversal.h.