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

#include <sync_union_tarball.h>

Inheritance diagram for publish::SyncUnionTarball:
Collaboration diagram for publish::SyncUnionTarball:

Public Member Functions

 SyncUnionTarball (AbstractSyncMediator *mediator, const std::string &rdonly_path, const std::string &tarball_path, const std::string &base_directory, const std::string &to_delete, const bool create_catalog_on_root)
 
 ~SyncUnionTarball ()
 
bool Initialize ()
 
void Traverse ()
 
void PostUpload ()
 
std::string UnwindWhiteoutFilename (SharedPtr< SyncItem > entry) const
 
bool IsOpaqueDirectory (SharedPtr< SyncItem > directory) const
 
bool IsWhiteoutEntry (SharedPtr< SyncItem > entry) const
 
- 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 ()
 
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
 

Private Member Functions

void CreateDirectories (const std::string &target)
 
void ProcessArchiveEntry (struct archive_entry *entry)
 
std::string SanitizePath (const std::string &path)
 

Private Attributes

struct archive * src
 
const std::string tarball_path_
 
const std::string base_directory_
 
const std::string to_delete_
 entity to delete before to extract the tar More...
 
const bool create_catalog_on_root_
 
std::set< std::string > know_directories_
 directory that we know already exist More...
 
std::set< std::string > to_create_catalog_dirs_
 
std::map< std::string,
SharedPtr< SyncItem > > 
dirs_
 
std::map< const std::string,
std::list< std::string > > 
hardlinks_
 
Signalread_archive_signal_
 

Static Private Attributes

static const size_t kBlockSize = 4096 * 4
 

Additional Inherited Members

- Protected Member Functions inherited from publish::SyncUnion
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 inherited from publish::SyncUnion
std::string rdonly_path_
 
std::string scratch_path_
 
std::string union_path_
 
AbstractSyncMediatormediator_
 

Detailed Description

Definition at line 28 of file sync_union_tarball.h.

Constructor & Destructor Documentation

publish::SyncUnionTarball::SyncUnionTarball ( AbstractSyncMediator mediator,
const std::string &  rdonly_path,
const std::string &  tarball_path,
const std::string &  base_directory,
const std::string &  to_delete,
const bool  create_catalog_on_root 
)

Definition at line 33 of file sync_union_tarball.cc.

publish::SyncUnionTarball::~SyncUnionTarball ( )

Definition at line 47 of file sync_union_tarball.cc.

Member Function Documentation

void publish::SyncUnionTarball::CreateDirectories ( const std::string &  target)
private

create missing directory and all the ancestors It is possible to find the leaf of the filesystem tree before than its root while traversing a tar file, however we need to have all the directories in place before adding entities. This method is called whener we find a new directory. The method create a new dummy directory and, if necessary, all of its parents.

Parameters
targetthe directory to create

Definition at line 322 of file sync_union_tarball.cc.

Referenced by ProcessArchiveEntry().

Here is the call graph for this function:

Here is the caller graph for this function:

bool publish::SyncUnionTarball::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 49 of file sync_union_tarball.cc.

Here is the call graph for this function:

bool publish::SyncUnionTarball::IsOpaqueDirectory ( SharedPtr< SyncItem directory) const
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

Implements publish::SyncUnion.

Definition at line 307 of file sync_union_tarball.cc.

bool publish::SyncUnionTarball::IsWhiteoutEntry ( SharedPtr< SyncItem entry) const
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

Implements publish::SyncUnion.

Definition at line 311 of file sync_union_tarball.cc.

void publish::SyncUnionTarball::PostUpload ( )
virtual

Reimplemented from publish::SyncUnion.

Definition at line 290 of file sync_union_tarball.cc.

Here is the call graph for this function:

void publish::SyncUnionTarball::ProcessArchiveEntry ( struct archive_entry *  entry)
private

Definition at line 189 of file sync_union_tarball.cc.

Referenced by Traverse().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string publish::SyncUnionTarball::SanitizePath ( const std::string &  path)
private

Definition at line 276 of file sync_union_tarball.cc.

Referenced by ProcessArchiveEntry().

Here is the caller graph for this function:

void publish::SyncUnionTarball::Traverse ( )
virtual

Main routine, process scratch space

Implements publish::SyncUnion.

Definition at line 100 of file sync_union_tarball.cc.

Here is the call graph for this function:

std::string publish::SyncUnionTarball::UnwindWhiteoutFilename ( SharedPtr< SyncItem entry) const
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

Implements publish::SyncUnion.

Definition at line 302 of file sync_union_tarball.cc.

Member Data Documentation

const std::string publish::SyncUnionTarball::base_directory_
private

Definition at line 65 of file sync_union_tarball.h.

Referenced by ProcessArchiveEntry(), and Traverse().

const bool publish::SyncUnionTarball::create_catalog_on_root_
private

Definition at line 67 of file sync_union_tarball.h.

Referenced by Traverse().

std::map<std::string, SharedPtr<SyncItem> > publish::SyncUnionTarball::dirs_
private

map of all directories found, we need them since we don't know, at priori, where the catalog files appears

Definition at line 81 of file sync_union_tarball.h.

Referenced by CreateDirectories(), ProcessArchiveEntry(), and Traverse().

std::map<const std::string, std::list<std::string> > publish::SyncUnionTarball::hardlinks_
private

map all the file that point to the same hardlink to the path of the file itself

Definition at line 87 of file sync_union_tarball.h.

Referenced by PostUpload(), and ProcessArchiveEntry().

const size_t publish::SyncUnionTarball::kBlockSize = 4096 * 4
staticprivate

Definition at line 94 of file sync_union_tarball.h.

Referenced by Initialize().

std::set<std::string> publish::SyncUnionTarball::know_directories_
private

directory that we know already exist

Definition at line 69 of file sync_union_tarball.h.

Referenced by CreateDirectories(), and ProcessArchiveEntry().

Signal* publish::SyncUnionTarball::read_archive_signal_
private

Conditional variable to keep track of when is possible to read the tar file

Definition at line 92 of file sync_union_tarball.h.

Referenced by ProcessArchiveEntry(), Traverse(), and ~SyncUnionTarball().

struct archive* publish::SyncUnionTarball::src
private

Definition at line 63 of file sync_union_tarball.h.

Referenced by Initialize(), ProcessArchiveEntry(), and Traverse().

const std::string publish::SyncUnionTarball::tarball_path_
private

Definition at line 64 of file sync_union_tarball.h.

Referenced by Initialize().

std::set<std::string> publish::SyncUnionTarball::to_create_catalog_dirs_
private

directories where we found catalog marker, after the main traverse we iterate through them and we add the catalog

Definition at line 75 of file sync_union_tarball.h.

Referenced by ProcessArchiveEntry(), and Traverse().

const std::string publish::SyncUnionTarball::to_delete_
private

entity to delete before to extract the tar

Definition at line 66 of file sync_union_tarball.h.

Referenced by Traverse().


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