CernVM-FS  2.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
swissknife::CatalogTraversalBase< ObjectFetcherT > Class Template Referenceabstract

#include <catalog_traversal.h>

Inheritance diagram for swissknife::CatalogTraversalBase< ObjectFetcherT >:
Collaboration diagram for swissknife::CatalogTraversalBase< ObjectFetcherT >:

Classes

struct  CatalogJob
 
struct  Parameters
 

Public Types

enum  TraversalType { kBreadthFirst, kDepthFirst }
 
typedef ObjectFetcherT ObjectFetcherTN
 
typedef ObjectFetcherT::CatalogTN CatalogTN
 
typedef ObjectFetcherT::HistoryTN HistoryTN
 
typedef CatalogTraversalData
< CatalogTN
CallbackDataTN
 
- Public Types inherited from Observable< CatalogTraversalData< ObjectFetcherT::CatalogTN > >
typedef Callbackable
< CatalogTraversalData
< ObjectFetcherT::CatalogTN >
>::CallbackTN
CallbackPtr
 
- Public Types inherited from Callbackable< CatalogTraversalData< ObjectFetcherT::CatalogTN > >
typedef CallbackBase
< CatalogTraversalData
< ObjectFetcherT::CatalogTN > > 
CallbackTN
 

Public Member Functions

 CatalogTraversalBase (const Parameters &params)
 
virtual bool Traverse (const TraversalType type=kBreadthFirst)=0
 
virtual bool Traverse (const shash::Any &root_catalog_hash, const TraversalType type=kBreadthFirst)=0
 
virtual bool TraverseList (const std::vector< shash::Any > &catalog_list, const TraversalType type=kBreadthFirst)=0
 
virtual bool TraverseRevision (const shash::Any &root_catalog_hash, const TraversalType type=kBreadthFirst)=0
 
virtual bool TraverseNamedSnapshots (const TraversalType type=kBreadthFirst)
 
void SetCatalogInfoShim (CatalogTraversalInfoShim< CatalogTN > *shim)
 
- Public Member Functions inherited from Observable< CatalogTraversalData< ObjectFetcherT::CatalogTN > >
virtual ~Observable ()
 
CallbackPtr RegisterListener (typename BoundClosure< CatalogTraversalData< ObjectFetcherT::CatalogTN >, DelegateT, ClosureDataT >::CallbackMethod method, DelegateT *delegate, ClosureDataT data)
 
CallbackPtr RegisterListener (typename BoundCallback< CatalogTraversalData< ObjectFetcherT::CatalogTN >, DelegateT >::CallbackMethod method, DelegateT *delegate)
 
CallbackPtr RegisterListener (typename Callback< CatalogTraversalData< ObjectFetcherT::CatalogTN > >::CallbackFunction fn)
 
void UnregisterListener (CallbackPtr callback_object)
 
void UnregisterListeners ()
 

Protected Types

typedef std::set< shash::AnyHashSet
 
- Protected Types inherited from Observable< CatalogTraversalData< ObjectFetcherT::CatalogTN > >
typedef std::set< CallbackPtrCallbacks
 

Protected Member Functions

bool PrepareCatalog (CatalogJob *job)
 
bool ReopenCatalog (CatalogJob *job)
 
bool CloseCatalog (const bool unlink_db, CatalogJob *job)
 
shash::Any GetRepositoryRootCatalogHash ()
 
bool IsBelowPruningThresholds (const CatalogJob &job, const unsigned history_depth, const time_t timestamp_threshold)
 
- Protected Member Functions inherited from Observable< CatalogTraversalData< ObjectFetcherT::CatalogTN > >
void RegisterListener (CallbackPtr callback_object)
 
 Observable ()
 
void NotifyListeners (const CatalogTraversalData< ObjectFetcherT::CatalogTN > &parameter)
 

Protected Attributes

ObjectFetcherT * object_fetcher_
 
CatalogTraversalInfoShim
< CatalogTN
catalog_info_default_shim_
 
CatalogTraversalInfoShim
< CatalogTN > * 
catalog_info_shim_
 
const unsigned int default_history_depth_
 
const time_t default_timestamp_threshold_
 
const bool no_close_
 
const bool ignore_load_failure_
 
const bool no_repeat_history_
 
LogFacilities error_sink_
 

Additional Inherited Members

- Static Public Member Functions inherited from Callbackable< CatalogTraversalData< ObjectFetcherT::CatalogTN > >
static CallbackTNMakeClosure (typename BoundClosure< CatalogTraversalData< ObjectFetcherT::CatalogTN >, DelegateT, ClosureDataT >::CallbackMethod method, DelegateT *delegate, const ClosureDataT &closure_data)
 
static CallbackTNMakeCallback (typename BoundCallback< CatalogTraversalData< ObjectFetcherT::CatalogTN >, DelegateT >::CallbackMethod method, DelegateT *delegate)
 
static CallbackTNMakeCallback (typename Callback< CatalogTraversalData< ObjectFetcherT::CatalogTN > >::CallbackFunction function)
 

Detailed Description

template<class ObjectFetcherT>
class swissknife::CatalogTraversalBase< ObjectFetcherT >

A base class for CatalogTraversal and CatalogTraversalParallel implementing common functionality. Actual traversal classes inherit from this class.

Definition at line 88 of file catalog_traversal.h.

Member Typedef Documentation

template<class ObjectFetcherT >
typedef CatalogTraversalData<CatalogTN> swissknife::CatalogTraversalBase< ObjectFetcherT >::CallbackDataTN

Definition at line 95 of file catalog_traversal.h.

template<class ObjectFetcherT >
typedef ObjectFetcherT::CatalogTN swissknife::CatalogTraversalBase< ObjectFetcherT >::CatalogTN

Definition at line 93 of file catalog_traversal.h.

template<class ObjectFetcherT >
typedef std::set<shash::Any> swissknife::CatalogTraversalBase< ObjectFetcherT >::HashSet
protected

Definition at line 268 of file catalog_traversal.h.

template<class ObjectFetcherT >
typedef ObjectFetcherT::HistoryTN swissknife::CatalogTraversalBase< ObjectFetcherT >::HistoryTN

Definition at line 94 of file catalog_traversal.h.

template<class ObjectFetcherT >
typedef ObjectFetcherT swissknife::CatalogTraversalBase< ObjectFetcherT >::ObjectFetcherTN

Definition at line 92 of file catalog_traversal.h.

Member Enumeration Documentation

template<class ObjectFetcherT >
enum swissknife::CatalogTraversalBase::TraversalType
Enumerator
kBreadthFirst 
kDepthFirst 

Definition at line 162 of file catalog_traversal.h.

Constructor & Destructor Documentation

template<class ObjectFetcherT >
swissknife::CatalogTraversalBase< ObjectFetcherT >::CatalogTraversalBase ( const Parameters params)
inlineexplicit

Definition at line 167 of file catalog_traversal.h.

Here is the call graph for this function:

Member Function Documentation

template<class ObjectFetcherT >
bool swissknife::CatalogTraversalBase< ObjectFetcherT >::CloseCatalog ( const bool  unlink_db,
CatalogJob job 
)
inlineprotected
template<class ObjectFetcherT >
shash::Any swissknife::CatalogTraversalBase< ObjectFetcherT >::GetRepositoryRootCatalogHash ( )
inlineprotected

Definition at line 388 of file catalog_traversal.h.

Referenced by swissknife::CatalogTraversalParallel< ObjectFetcherT >::Traverse(), and swissknife::CatalogTraversal< ObjectFetcherT >::Traverse().

Here is the call graph for this function:

Here is the caller graph for this function:

template<class ObjectFetcherT >
bool swissknife::CatalogTraversalBase< ObjectFetcherT >::IsBelowPruningThresholds ( const CatalogJob job,
const unsigned  history_depth,
const time_t  timestamp_threshold 
)
inlineprotected

Checks if a root catalog is below one of the pruning thresholds. Pruning thesholds can be either the catalog's history depth or a timestamp threshold applied to the last modified timestamp of the catalog.

Parameters
ctxtraversal context for traversal-specific state
jobthe job defining the current catalog
Returns
true if either history or timestamp threshold are satisfied

Definition at line 414 of file catalog_traversal.h.

Referenced by swissknife::CatalogTraversalParallel< ObjectFetcherT >::PushPreviousRevision(), and swissknife::CatalogTraversal< ObjectFetcherT >::PushPreviousRevision().

Here is the call graph for this function:

Here is the caller graph for this function:

template<class ObjectFetcherT >
bool swissknife::CatalogTraversalBase< ObjectFetcherT >::PrepareCatalog ( CatalogJob job)
inlineprotected

Definition at line 314 of file catalog_traversal.h.

Referenced by swissknife::CatalogTraversal< ObjectFetcherT >::DoTraverse(), and swissknife::CatalogTraversalParallel< ObjectFetcherT >::ProcessJobPre().

Here is the call graph for this function:

Here is the caller graph for this function:

template<class ObjectFetcherT >
bool swissknife::CatalogTraversalBase< ObjectFetcherT >::ReopenCatalog ( CatalogJob job)
inlineprotected

Definition at line 353 of file catalog_traversal.h.

Referenced by swissknife::CatalogTraversalParallel< ObjectFetcherT >::ProcessJobPost().

Here is the call graph for this function:

Here is the caller graph for this function:

template<class ObjectFetcherT >
void swissknife::CatalogTraversalBase< ObjectFetcherT >::SetCatalogInfoShim ( CatalogTraversalInfoShim< CatalogTN > *  shim)
inline

Definition at line 263 of file catalog_traversal.h.

template<class ObjectFetcherT >
virtual bool swissknife::CatalogTraversalBase< ObjectFetcherT >::Traverse ( const TraversalType  type = kBreadthFirst)
pure virtual

Starts the traversal process. After calling this methods CatalogTraversal will go through all catalogs and call the registered callback methods for each found catalog. If something goes wrong in the process, the traversal will be cancelled.

Parameters
typebreadths or depth first traversal
Returns
true, when all catalogs were successfully processed. On failure the traversal is cancelled and false is returned.

Implemented in swissknife::CatalogTraversal< ObjectFetcherT >, and swissknife::CatalogTraversalParallel< ObjectFetcherT >.

template<class ObjectFetcherT >
virtual bool swissknife::CatalogTraversalBase< ObjectFetcherT >::Traverse ( const shash::Any root_catalog_hash,
const TraversalType  type = kBreadthFirst 
)
pure virtual

Starts the traversal process at the catalog pointed to by the given hash

Parameters
root_catalog_hashthe entry point into the catalog traversal
typebreadths or depth first traversal
Returns
true when catalogs were successfully traversed

Implemented in swissknife::CatalogTraversal< ObjectFetcherT >, and swissknife::CatalogTraversalParallel< ObjectFetcherT >.

template<class ObjectFetcherT >
virtual bool swissknife::CatalogTraversalBase< ObjectFetcherT >::TraverseList ( const std::vector< shash::Any > &  catalog_list,
const TraversalType  type = kBreadthFirst 
)
pure virtual

Traverse a list of revisions represented by root catalogs from first to last. DO NOT traverse previous revisions based on history and timestamp threshold settings.

Parameters
catalog_listlist of root catalog hashes
typebreadth- or depth- first traversal
Returns
true on success

Implemented in swissknife::CatalogTraversal< ObjectFetcherT >.

Referenced by swissknife::CatalogTraversalBase< ObjectFetcherT >::TraverseNamedSnapshots().

Here is the caller graph for this function:

template<class ObjectFetcherT >
virtual bool swissknife::CatalogTraversalBase< ObjectFetcherT >::TraverseNamedSnapshots ( const TraversalType  type = kBreadthFirst)
inlinevirtual

Figures out all named tags in a repository and uses all of them as entry points into the traversal process.

Parameters
typebreadths or depth first traversal
Returns
true when catalog traversal successfully finished

Definition at line 233 of file catalog_traversal.h.

Here is the call graph for this function:

template<class ObjectFetcherT >
virtual bool swissknife::CatalogTraversalBase< ObjectFetcherT >::TraverseRevision ( const shash::Any root_catalog_hash,
const TraversalType  type = kBreadthFirst 
)
pure virtual

Starts the traversal process at the catalog pointed to by the given hash but doesn't traverse into predecessor catalog revisions. This overrides the TraversalParameter settings provided at construction.

Parameters
root_catalog_hashthe entry point into the catalog traversal
typebreadths or depth first traversal
Returns
true when catalogs were successfully traversed

Implemented in swissknife::CatalogTraversal< ObjectFetcherT >, and swissknife::CatalogTraversalParallel< ObjectFetcherT >.

Member Data Documentation

template<class ObjectFetcherT >
CatalogTraversalInfoShim<CatalogTN> swissknife::CatalogTraversalBase< ObjectFetcherT >::catalog_info_default_shim_
protected

Definition at line 432 of file catalog_traversal.h.

template<class ObjectFetcherT >
const bool swissknife::CatalogTraversalBase< ObjectFetcherT >::ignore_load_failure_
protected

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