CernVM-FS
2.12.0
|
#include <dirtab.h>
Classes | |
struct | Rule |
Public Types | |
typedef std::vector< Rule > | Rules |
Public Member Functions | |
Dirtab () | |
virtual | ~Dirtab () |
virtual bool | Parse (const std::string &dirtab) |
virtual bool | Parse (FILE *dirtab_file) |
virtual bool | IsMatching (const std::string &path) const |
virtual bool | IsOpposing (const std::string &path) const |
const Rules & | positive_rules () const |
const Rules & | negative_rules () const |
size_t | RuleCount () const |
size_t | NegativeRuleCount () const |
size_t | PositiveRuleCount () const |
bool | IsValid () const |
Static Public Member Functions | |
static Dirtab * | Create (const std::string &dirtab_path) |
Static Public Attributes | |
static const char | kCommentMarker = '#' |
static const char | kNegationMarker = '!' |
Protected Member Functions | |
bool | Open (const std::string &dirtab_path) |
bool | ParseLine (const std::string &line) |
virtual bool | ParsePathspec (const std::string &pathspec_str, bool negation) |
void | AddRule (const Rule &rule) |
Private Member Functions | |
void | SkipWhitespace (const std::string::const_iterator &end, std::string::const_iterator *itr) const |
bool | CheckRuleValidity () const |
Private Attributes | |
bool | valid_ |
Rules | positive_rules_ |
Rules | negative_rules_ |
A Dirtab is handling the parsing and processing of the .cvmfsdirtab file. The .cvmfsdirtab contains a list of Pathspecs that define where CernVM-FS should automatically create nested catalogs. Furthermore it can contain neg- ative rules to omit the automatic creation of nested catalogs in certain directories.
Example (adding a space in front of * - silence compiler warning):
/software/releases/ * /conditions_data/runs/ *
! *.svn ! *.git
This .cvmfsdirtab file would generate nested catalogs in all directories directly inside /software/releases/ and /conditions_data/runs/ like: /software/releases/2.1.1-2/.cvmfscatalog /software/releases/2.3.4-1/.cvmfscatalog /software/releases/3.0.0-5/.cvmfscatalog ... /conditions_data/runs/27.11.2014/.cvmfscatalog /conditions_data/runs/11.09.2013/.cvmfscatalog ...
Note: This class does not take care of the actual creation of nested catalogs but wraps the parsing and matching of the .cvmfsdirtab file and given path strings. See: swissknife_sync.{h,cc} or t_dirtab.cc for the usage of this class.
typedef std::vector<Rule> catalog::Dirtab::Rules |
catalog::Dirtab::Dirtab | ( | ) |
|
protected |
Definition at line 115 of file dirtab.cc.
Referenced by ParsePathspec().
|
private |
|
inlinestatic |
Returns an already filled Dirtab
dirtab_path | path of the dirtab file that will be used to fill the Dirtab object |
Definition at line 84 of file dirtab.h.
Referenced by swissknife::CommandApplyDirtab::Main().
|
virtual |
Matches a given path string against this Dirtab. The path is considered a match if it matches against (at least) one positive rule and is not matched by any negative rule.
path | the path string to be matched against this Dirtab |
Reimplemented in catalog::RelaxedPathFilter.
Definition at line 144 of file dirtab.cc.
Referenced by catalog::RelaxedPathFilter::IsMatching().
|
virtual |
Matches a given path string against all negative rules in this Dirtab. This bypasses the check for positive rules, thus a path string can be opposed by this Dirtab while it would also not match any positive rule.
path | the path string to be checked for opposition of this Dirtab |
Reimplemented in catalog::RelaxedPathFilter.
Definition at line 161 of file dirtab.cc.
Referenced by swissknife::CommandApplyDirtab::FilterCandidatesFromGlobResult(), IsMatching(), and catalog::RelaxedPathFilter::IsOpposing().
|
inline |
Definition at line 127 of file dirtab.h.
Referenced by swissknife::CommandPull::Main(), and swissknife::CommandApplyDirtab::Main().
|
inline |
|
inline |
Definition at line 125 of file dirtab.h.
Referenced by RuleCount().
|
protected |
Fill a Dirtab from a given .cvmfsdirtab file path.
Definition at line 21 of file dirtab.cc.
Referenced by catalog::RelaxedPathFilter::Create(), and Create().
|
virtual |
Parses the content of a .cvmfsdirtab file. This is called by the filepath- constructor or can be used on an empty Dirtab for testing purposes and in inherited classes.
dirtab | a string containing the full content of a .cvmfsdirtab file |
Reimplemented in catalog::RelaxedPathFilter.
Definition at line 43 of file dirtab.cc.
Referenced by Open(), and catalog::RelaxedPathFilter::Parse().
|
virtual |
Reimplemented in catalog::RelaxedPathFilter.
Definition at line 59 of file dirtab.cc.
|
protected |
|
protectedvirtual |
Reimplemented in catalog::RelaxedPathFilter.
Definition at line 95 of file dirtab.cc.
Referenced by ParseLine(), and catalog::RelaxedPathFilter::ParsePathspec().
|
inline |
Definition at line 121 of file dirtab.h.
Referenced by swissknife::CommandApplyDirtab::DetermineNestedCatalogCandidates().
|
inline |
Definition at line 126 of file dirtab.h.
Referenced by RuleCount().
|
inline |
Definition at line 124 of file dirtab.h.
Referenced by swissknife::CommandApplyDirtab::Main().
|
inlineprivate |
Definition at line 139 of file dirtab.h.
Referenced by ParseLine().
|
static |
Definition at line 53 of file dirtab.h.
Referenced by ParseLine().
|
static |
Definition at line 54 of file dirtab.h.
Referenced by ParseLine().
|
private |
Definition at line 150 of file dirtab.h.
Referenced by AddRule(), CheckRuleValidity(), IsOpposing(), negative_rules(), and NegativeRuleCount().
|
private |
Definition at line 149 of file dirtab.h.
Referenced by AddRule(), CheckRuleValidity(), IsMatching(), positive_rules(), and PositiveRuleCount().
|
private |