CernVM-FS  2.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
publish::SyncUnion Class Referenceabstract

#include <sync_union.h>

Inheritance diagram for publish::SyncUnion:
Collaboration diagram for publish::SyncUnion:

Public Member Functions

 SyncUnion (AbstractSyncMediator *mediator, const std::string &rdonly_path, const std::string &union_path, const std::string &scratch_path)
 
virtual ~SyncUnion ()
 
virtual bool Initialize ()
 
virtual void Traverse ()=0
 
virtual void PostUpload ()
 
SharedPtr< SyncItemCreateSyncItem (const std::string &relative_parent_path, const std::string &filename, const SyncItemType entry_type) const
 
std::string rdonly_path () const
 
std::string union_path () const
 
std::string scratch_path () const
 
virtual std::string UnwindWhiteoutFilename (SharedPtr< SyncItem > entry) const =0
 
virtual bool IsOpaqueDirectory (SharedPtr< SyncItem > directory) const =0
 
virtual bool IsWhiteoutEntry (SharedPtr< SyncItem > entry) const =0
 
virtual bool IgnoreFilePredicate (const std::string &parent_dir, const std::string &filename)
 
bool IsInitialized () const
 
virtual bool SupportsHardlinks () const
 

Protected Member Functions

virtual void PreprocessSyncItem (SharedPtr< SyncItem > entry) const
 
virtual void ProcessRegularFile (const std::string &parent_dir, const std::string &filename)
 
virtual bool ProcessDirectory (const std::string &parent_dir, const std::string &dir_name)
 
virtual bool ProcessDirectory (SharedPtr< SyncItem > entry)
 
virtual bool ProcessUnmaterializedDirectory (SharedPtr< SyncItem > entry)
 
virtual void ProcessSymlink (const std::string &parent_dir, const std::string &link_name)
 
virtual void EnterDirectory (const std::string &parent_dir, const std::string &dir_name)
 
virtual void LeaveDirectory (const std::string &parent_dir, const std::string &dir_name)
 
void ProcessCharacterDevice (const std::string &parent_dir, const std::string &filename)
 
void ProcessBlockDevice (const std::string &parent_dir, const std::string &filename)
 
void ProcessFifo (const std::string &parent_dir, const std::string &filename)
 
void ProcessSocket (const std::string &parent_dir, const std::string &filename)
 
void ProcessFile (SharedPtr< SyncItem > entry)
 

Protected Attributes

std::string rdonly_path_
 
std::string scratch_path_
 
std::string union_path_
 
AbstractSyncMediatormediator_
 

Private Attributes

bool initialized_
 

Detailed Description

Interface definition of repository synchronization based on a union filesystem overlay on top of a mounted CVMFS volume.

Definition at line 55 of file sync_union.h.

Constructor & Destructor Documentation

publish::SyncUnion::SyncUnion ( AbstractSyncMediator mediator,
const std::string &  rdonly_path,
const std::string &  union_path,
const std::string &  scratch_path 
)
Parameters
rdonly_paththe absolute path to the mounted cvmfs repository
union_paththe absolute path to the mounted union file system volume
scratch_paththe absolute path to the read write branch attached to the union file system
mediatora reference to a SyncMediator object used as bridge to the actual sync process

Definition at line 14 of file sync_union.cc.

virtual publish::SyncUnion::~SyncUnion ( )
inlinevirtual

Definition at line 67 of file sync_union.h.

Member Function Documentation

SharedPtr< SyncItem > publish::SyncUnion::CreateSyncItem ( const std::string &  relative_parent_path,
const std::string &  filename,
const SyncItemType  entry_type 
) const

This produces a SyncItem and initialises it accordingly. This is the only way client code can generate SyncItems to make sure it is always set up properly (see SyncItem::SyncItem() for further details).

Parameters
relative_parent_paththe directory path the SyncItem resides in
filenamefile/directory name of directory entry
entry_typetype of the item in the union directory
Returns
a SyncItem object wrapping the dirent

Definition at line 30 of file sync_union.cc.

Referenced by publish::SyncMediator::CreateSyncItem(), EnterDirectory(), LeaveDirectory(), ProcessBlockDevice(), ProcessCharacterDevice(), ProcessFifo(), ProcessRegularFile(), ProcessSocket(), ProcessSymlink(), and publish::SyncUnionTarball::Traverse().

Here is the call graph for this function:

Here is the caller graph for this function:

void publish::SyncUnion::EnterDirectory ( const std::string &  parent_dir,
const std::string &  dir_name 
)
protectedvirtual

Called if the file system traversal enters a directory for processing.

Parameters
parent_dirthe relative directory path.

Definition at line 135 of file sync_union.cc.

Referenced by publish::SyncUnionAufs::Traverse(), and publish::SyncUnionOverlayfs::Traverse().

Here is the call graph for this function:

Here is the caller graph for this function:

bool publish::SyncUnion::IgnoreFilePredicate ( const std::string &  parent_dir,
const std::string &  filename 
)
virtual

Union file systems may use some special files for bookkeeping. They must not show up in to repository and are ignored by the recursion. Note: This needs to be up-called!

Parameters
parentdirectory in which file resides
filenameto decide whether to ignore or not
Returns
true if file should be ignored, othewise false

Reimplemented in publish::SyncUnionAufs.

Definition at line 57 of file sync_union.cc.

Referenced by publish::SyncMediator::IgnoreFileCallback(), publish::SyncUnionAufs::IgnoreFilePredicate(), and publish::SyncUnionOverlayfs::Traverse().

Here is the caller graph for this function:

bool publish::SyncUnion::Initialize ( )
virtual

Initialize internal state of the synchronisation. This needs to be called before running anything else. Note: should be up-called!

Reimplemented in publish::SyncUnionTarball, and publish::SyncUnionOverlayfs.

Definition at line 24 of file sync_union.cc.

Referenced by publish::ConstructSyncManagers(), publish::SyncUnionOverlayfs::Initialize(), publish::SyncUnionTarball::Initialize(), swissknife::Ingest::Main(), and swissknife::CommandSync::Main().

Here is the call graph for this function:

Here is the caller graph for this function:

bool publish::SyncUnion::IsInitialized ( ) const
inline

Definition at line 139 of file sync_union.h.

Referenced by publish::SyncUnionAufs::Traverse(), publish::SyncUnionOverlayfs::Traverse(), and publish::SyncUnionTarball::Traverse().

Here is the caller graph for this function:

virtual bool publish::SyncUnion::IsOpaqueDirectory ( SharedPtr< SyncItem directory) const
pure virtual

Union file systems use opaque directories to fully support rmdir e.g: $ rm -rf directory $ mkdir directory This would produce an opaque directory whose contents are NOT merged with the underlying directory in the read-only branch

Parameters
directorythe directory to check for opacity
Returns
true if directory is opaque, otherwise false

Implemented in publish::SyncUnionTarball, publish::SyncUnionOverlayfs, and publish::SyncUnionAufs.

Referenced by PreprocessSyncItem().

Here is the caller graph for this function:

virtual bool publish::SyncUnion::IsWhiteoutEntry ( SharedPtr< SyncItem entry) const
pure virtual

Checks if given file is supposed to be whiteout. These files indicate that a specific file has been deleted.

Parameters
filenamethe filename to check
Returns
true if filename seems to be whiteout otherwise false

Implemented in publish::SyncUnionTarball, publish::SyncUnionOverlayfs, and publish::SyncUnionAufs.

Referenced by PreprocessSyncItem().

Here is the caller graph for this function:

void publish::SyncUnion::LeaveDirectory ( const std::string &  parent_dir,
const std::string &  dir_name 
)
protectedvirtual

Called before the file system traversal leaves a processed directory.

Parameters
parent_dirthe relative directory path.

Definition at line 141 of file sync_union.cc.

Referenced by publish::SyncUnionAufs::Traverse(), and publish::SyncUnionOverlayfs::Traverse().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void publish::SyncUnion::PostUpload ( )
inlinevirtual

Reimplemented in publish::SyncUnionTarball.

Definition at line 81 of file sync_union.h.

Referenced by publish::SyncMediator::Commit().

Here is the caller graph for this function:

void publish::SyncUnion::PreprocessSyncItem ( SharedPtr< SyncItem entry) const
protectedvirtual

Allow for preprocessing steps before emiting any SyncItems from SyncUnion. This can be overridden by sub-classes but should always be up-called. Typi- cally this sets whiteout and opaque-directory flags or handles hardlinks.

Parameters
entrythe SyncItem to be pre-processed (pointer parameter for google style guide compliance [1]) [1] https://google-styleguide.googlecode.com/svn/trunk/ cppguide.html::Function_Parameter_Ordering

Reimplemented in publish::SyncUnionOverlayfs.

Definition at line 47 of file sync_union.cc.

Referenced by CreateSyncItem(), and publish::SyncUnionOverlayfs::PreprocessSyncItem().

Here is the call graph for this function:

Here is the caller graph for this function:

void publish::SyncUnion::ProcessBlockDevice ( const std::string &  parent_dir,
const std::string &  filename 
)
protected

Callback when a block device is found

Parameters
parent_dirthe relative directory path
filenamethe filename

Definition at line 157 of file sync_union.cc.

Referenced by publish::SyncUnionAufs::Traverse(), and publish::SyncUnionOverlayfs::Traverse().

Here is the call graph for this function:

Here is the caller graph for this function:

void publish::SyncUnion::ProcessCharacterDevice ( const std::string &  parent_dir,
const std::string &  filename 
)
protected

Callback when a character device is found

Parameters
parent_dirthe relative directory path
filenamethe filename

Definition at line 147 of file sync_union.cc.

Referenced by publish::SyncUnionAufs::Traverse(), and publish::SyncUnionOverlayfs::Traverse().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool publish::SyncUnion::ProcessDirectory ( const std::string &  parent_dir,
const std::string &  dir_name 
)
protectedvirtual

Callback when a directory is found.

Parameters
parent_dirthe relative directory path
dir_namethe filename
Returns
true if file system traversal should branch into the given directory, false otherwise

Referenced by publish::SyncUnionAufs::Traverse(), publish::SyncUnionOverlayfs::Traverse(), and publish::SyncUnionTarball::Traverse().

Here is the caller graph for this function:

bool publish::SyncUnion::ProcessDirectory ( SharedPtr< SyncItem entry)
protectedvirtual

Definition at line 70 of file sync_union.cc.

Here is the call graph for this function:

void publish::SyncUnion::ProcessFifo ( const std::string &  parent_dir,
const std::string &  filename 
)
protected

Callback when a named pipe is found.

Parameters
parent_dirthe relative directory path
filenamethe filename

Definition at line 167 of file sync_union.cc.

Referenced by publish::SyncUnionAufs::Traverse(), and publish::SyncUnionOverlayfs::Traverse().

Here is the call graph for this function:

Here is the caller graph for this function:

void publish::SyncUnion::ProcessFile ( SharedPtr< SyncItem entry)
protected

Called to actually process the file entry.

Parameters
entrythe SyncItem corresponding to the union file to be processed

Definition at line 116 of file sync_union.cc.

Referenced by publish::SyncUnionTarball::ProcessArchiveEntry(), ProcessBlockDevice(), ProcessCharacterDevice(), ProcessFifo(), ProcessRegularFile(), ProcessSocket(), ProcessSymlink(), and publish::SyncUnionTarball::Traverse().

Here is the call graph for this function:

Here is the caller graph for this function:

void publish::SyncUnion::ProcessRegularFile ( const std::string &  parent_dir,
const std::string &  filename 
)
protectedvirtual

Callback when a regular file is found.

Parameters
parent_dirthe relative directory path
filenamethe filename

Definition at line 99 of file sync_union.cc.

Referenced by publish::SyncUnionAufs::Traverse(), and publish::SyncUnionOverlayfs::Traverse().

Here is the call graph for this function:

Here is the caller graph for this function:

void publish::SyncUnion::ProcessSocket ( const std::string &  parent_dir,
const std::string &  filename 
)
protected

Callback when a unix domain socket is found.

Parameters
parent_dirthe relative directory path
filenamethe filename

Definition at line 175 of file sync_union.cc.

Referenced by publish::SyncUnionAufs::Traverse(), and publish::SyncUnionOverlayfs::Traverse().

Here is the call graph for this function:

Here is the caller graph for this function:

void publish::SyncUnion::ProcessSymlink ( const std::string &  parent_dir,
const std::string &  link_name 
)
protectedvirtual

Callback when a symlink is found.

Parameters
parent_dirthe relative directory path
link_namethe filename

Definition at line 107 of file sync_union.cc.

Referenced by publish::SyncUnionAufs::Traverse(), and publish::SyncUnionOverlayfs::Traverse().

Here is the call graph for this function:

Here is the caller graph for this function:

bool publish::SyncUnion::ProcessUnmaterializedDirectory ( SharedPtr< SyncItem entry)
protectedvirtual

Definition at line 92 of file sync_union.cc.

Referenced by publish::SyncUnionTarball::CreateDirectories(), and publish::SyncUnionTarball::ProcessArchiveEntry().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string publish::SyncUnion::rdonly_path ( ) const
inline

Definition at line 96 of file sync_union.h.

Referenced by publish::SyncItem::GetRdOnlyPath(), and publish::SyncMediator::RemoveDirectoryRecursively().

Here is the caller graph for this function:

std::string publish::SyncUnion::scratch_path ( ) const
inline
virtual bool publish::SyncUnion::SupportsHardlinks ( ) const
inlinevirtual

Reimplemented in publish::SyncUnionAufs.

Definition at line 140 of file sync_union.h.

Referenced by publish::SyncMediator::RegisterUnionEngine().

Here is the caller graph for this function:

virtual void publish::SyncUnion::Traverse ( )
pure virtual

Main routine, process scratch space

Implemented in publish::SyncUnionTarball, publish::SyncUnionOverlayfs, and publish::SyncUnionAufs.

Referenced by swissknife::Ingest::Main(), swissknife::CommandSync::Main(), and publish::SyncImpl().

Here is the caller graph for this function:

std::string publish::SyncUnion::union_path ( ) const
inline

Definition at line 97 of file sync_union.h.

Referenced by publish::SyncMediator::Add(), publish::SyncMediator::CompleteHardlinks(), and publish::SyncItem::GetUnionPath().

Here is the caller graph for this function:

virtual std::string publish::SyncUnion::UnwindWhiteoutFilename ( SharedPtr< SyncItem entry) const
pure virtual

Whiteout files may have special naming conventions. This method "unmangles" them and retrieves the original file name

Parameters
filenamethe filename as in the scratch directory
Returns
the original filename of the scratched out file in CVMFS repository

Implemented in publish::SyncUnionTarball, publish::SyncUnionOverlayfs, and publish::SyncUnionAufs.

Referenced by PreprocessSyncItem().

Here is the caller graph for this function:

Member Data Documentation

bool publish::SyncUnion::initialized_
private

Definition at line 240 of file sync_union.h.

Referenced by Initialize(), and IsInitialized().

std::string publish::SyncUnion::rdonly_path_
protected

Definition at line 143 of file sync_union.h.

Referenced by rdonly_path().

std::string publish::SyncUnion::scratch_path_
protected

Definition at line 144 of file sync_union.h.

Referenced by scratch_path().

std::string publish::SyncUnion::union_path_
protected

Definition at line 145 of file sync_union.h.

Referenced by union_path().


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