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

#include <sync_union_overlayfs.h>

Inheritance diagram for publish::SyncUnionOverlayfs:
Collaboration diagram for publish::SyncUnionOverlayfs:

Public Member Functions

 SyncUnionOverlayfs (SyncMediator *mediator, const std::string &rdonly_path, const std::string &union_path, const std::string &scratch_path)
 
bool Initialize ()
 
void Traverse ()
 
- Public Member Functions inherited from publish::SyncUnion
 SyncUnion (AbstractSyncMediator *mediator, const std::string &rdonly_path, const std::string &union_path, const std::string &scratch_path)
 
virtual ~SyncUnion ()
 
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 bool IgnoreFilePredicate (const std::string &parent_dir, const std::string &filename)
 
bool IsInitialized () const
 
virtual bool SupportsHardlinks () const
 

Static Public Member Functions

static bool ReadlinkEquals (std::string const &path, std::string const &compare_value)
 
static bool HasXattr (std::string const &path, std::string const &attr_name)
 

Protected Member Functions

void PreprocessSyncItem (SharedPtr< SyncItem > entry) const
 
bool IsWhiteoutEntry (SharedPtr< SyncItem > entry) const
 
bool IsOpaqueDirectory (SharedPtr< SyncItem > directory) const
 
bool IsWhiteoutSymlinkPath (const std::string &path) const
 
std::string UnwindWhiteoutFilename (SharedPtr< SyncItem > entry) const
 
std::set< std::string > GetIgnoreFilenames () const
 
void CheckForBrokenHardlink (SharedPtr< SyncItem > entry) const
 
void MaskFileHardlinks (SharedPtr< SyncItem > entry) const
 
bool ObtainSysAdminCapability () const
 
- Protected Member Functions inherited from publish::SyncUnion
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)
 

Private Member Functions

bool IsOpaqueDirPath (const std::string &path) const
 

Private Attributes

std::set< std::string > hardlink_lower_files_
 
uint64_t hardlink_lower_inode_
 

Additional Inherited Members

- Protected Attributes inherited from publish::SyncUnion
std::string rdonly_path_
 
std::string scratch_path_
 
std::string union_path_
 
AbstractSyncMediatormediator_
 

Detailed Description

Syncing a cvmfs repository by the help of an overlayed overlayfs read-write volume.

Definition at line 25 of file sync_union_overlayfs.h.

Constructor & Destructor Documentation

publish::SyncUnionOverlayfs::SyncUnionOverlayfs ( SyncMediator mediator,
const std::string &  rdonly_path,
const std::string &  union_path,
const std::string &  scratch_path 
)

Definition at line 21 of file sync_union_overlayfs.cc.

Member Function Documentation

void publish::SyncUnionOverlayfs::CheckForBrokenHardlink ( SharedPtr< SyncItem entry) const
protected

Definition at line 124 of file sync_union_overlayfs.cc.

Referenced by PreprocessSyncItem().

Here is the caller graph for this function:

std::set<std::string> publish::SyncUnionOverlayfs::GetIgnoreFilenames ( ) const
protected
bool publish::SyncUnionOverlayfs::HasXattr ( std::string const &  path,
std::string const &  attr_name 
)
static

Checks if a given file path has a specified extended attribute attached.

Parameters
[in]pathto the file to be checked
[in]attr_namefully qualified name of the extend attribute (i.e. trusted.overlay.opaque)
Returns
true if attribute is found

Definition at line 218 of file sync_union_overlayfs.cc.

Referenced by IsOpaqueDirPath().

Here is the call graph for this function:

Here is the caller graph for this function:

bool publish::SyncUnionOverlayfs::Initialize ( )
virtual

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

Reimplemented from publish::SyncUnion.

Definition at line 28 of file sync_union_overlayfs.cc.

Here is the call graph for this function:

bool publish::SyncUnionOverlayfs::IsOpaqueDirectory ( SharedPtr< SyncItem directory) const
protectedvirtual

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

Implements publish::SyncUnion.

Definition at line 265 of file sync_union_overlayfs.cc.

Here is the call graph for this function:

bool publish::SyncUnionOverlayfs::IsOpaqueDirPath ( const std::string &  path) const
private

Definition at line 271 of file sync_union_overlayfs.cc.

Referenced by IsOpaqueDirectory().

Here is the call graph for this function:

Here is the caller graph for this function:

bool publish::SyncUnionOverlayfs::IsWhiteoutEntry ( SharedPtr< SyncItem entry) const
protectedvirtual

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

There seem to be two versions of overlayfs out there and in production:

  1. whiteouts are 'character device' files
  2. whiteouts are symlinks pointing to '(overlay-whiteout)'

Implements publish::SyncUnion.

Definition at line 235 of file sync_union_overlayfs.cc.

Here is the call graph for this function:

bool publish::SyncUnionOverlayfs::IsWhiteoutSymlinkPath ( const std::string &  path) const
protected

Definition at line 251 of file sync_union_overlayfs.cc.

Referenced by IsWhiteoutEntry().

Here is the call graph for this function:

Here is the caller graph for this function:

void publish::SyncUnionOverlayfs::MaskFileHardlinks ( SharedPtr< SyncItem entry) const
protected

Definition at line 141 of file sync_union_overlayfs.cc.

Referenced by PreprocessSyncItem().

Here is the call graph for this function:

Here is the caller graph for this function:

bool publish::SyncUnionOverlayfs::ObtainSysAdminCapability ( ) const
protected

Definition at line 107 of file sync_union_overlayfs.cc.

Referenced by Initialize().

Here is the call graph for this function:

Here is the caller graph for this function:

void publish::SyncUnionOverlayfs::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 from publish::SyncUnion.

Definition at line 114 of file sync_union_overlayfs.cc.

Here is the call graph for this function:

bool publish::SyncUnionOverlayfs::ReadlinkEquals ( std::string const &  path,
std::string const &  compare_value 
)
static

Wrapper around readlink to read the value of the symbolic link and return true if it is equal to the supplied value, or false otherwise (including if any errors occur)

Parameters
[in]pathto the symbolic link
[in]valueto compare to link value

Definition at line 184 of file sync_union_overlayfs.cc.

Referenced by IsWhiteoutSymlinkPath().

Here is the caller graph for this function:

void publish::SyncUnionOverlayfs::Traverse ( )
virtual

Main routine, process scratch space

Implements publish::SyncUnion.

Definition at line 153 of file sync_union_overlayfs.cc.

Here is the call graph for this function:

string publish::SyncUnionOverlayfs::UnwindWhiteoutFilename ( SharedPtr< SyncItem entry) const
protectedvirtual

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

Implements publish::SyncUnion.

Definition at line 280 of file sync_union_overlayfs.cc.

Member Data Documentation

std::set<std::string> publish::SyncUnionOverlayfs::hardlink_lower_files_
private

Definition at line 56 of file sync_union_overlayfs.h.

uint64_t publish::SyncUnionOverlayfs::hardlink_lower_inode_
private

Definition at line 57 of file sync_union_overlayfs.h.


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