CernVM-FS
2.12.0
|
#include <sync_union_tarball.h>
Public Member Functions | |
SyncUnionTarball (AbstractSyncMediator *mediator, const std::string &rdonly_path, const std::string &tarball_path, const std::string &base_directory, const uid_t uid, const gid_t gid, 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< SyncItem > | CreateSyncItem (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 uid_t | uid_ |
const gid_t | gid_ |
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_ |
Signal * | read_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_ |
AbstractSyncMediator * | mediator_ |
Definition at line 28 of file sync_union_tarball.h.
publish::SyncUnionTarball::SyncUnionTarball | ( | AbstractSyncMediator * | mediator, |
const std::string & | rdonly_path, | ||
const std::string & | tarball_path, | ||
const std::string & | base_directory, | ||
const uid_t | uid, | ||
const gid_t | gid, | ||
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 51 of file sync_union_tarball.cc.
|
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.
target | the directory to create |
Definition at line 329 of file sync_union_tarball.cc.
Referenced by ProcessArchiveEntry(), and Traverse().
|
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 53 of file sync_union_tarball.cc.
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
directory | the directory to check for opacity |
Implements publish::SyncUnion.
Definition at line 314 of file sync_union_tarball.cc.
Checks if given file is supposed to be whiteout. These files indicate that a specific file has been deleted.
filename | the filename to check |
Implements publish::SyncUnion.
Definition at line 318 of file sync_union_tarball.cc.
|
virtual |
Reimplemented from publish::SyncUnion.
Definition at line 297 of file sync_union_tarball.cc.
|
private |
Definition at line 195 of file sync_union_tarball.cc.
Referenced by Traverse().
|
private |
Definition at line 283 of file sync_union_tarball.cc.
Referenced by ProcessArchiveEntry().
|
virtual |
Main routine, process scratch space
Implements publish::SyncUnion.
Definition at line 105 of file sync_union_tarball.cc.
|
virtual |
Whiteout files may have special naming conventions. This method "unmangles" them and retrieves the original file name
filename | the filename as in the scratch directory |
Implements publish::SyncUnion.
Definition at line 309 of file sync_union_tarball.cc.
|
private |
Definition at line 67 of file sync_union_tarball.h.
Referenced by ProcessArchiveEntry(), and Traverse().
|
private |
Definition at line 71 of file sync_union_tarball.h.
Referenced by Traverse().
map of all directories found, we need them since we don't know, at priori, where the catalog files appears
Definition at line 85 of file sync_union_tarball.h.
Referenced by CreateDirectories(), ProcessArchiveEntry(), and Traverse().
|
private |
Definition at line 69 of file sync_union_tarball.h.
Referenced by CreateDirectories(), and ProcessArchiveEntry().
|
private |
map all the file that point to the same hardlink to the path of the file itself
Definition at line 91 of file sync_union_tarball.h.
Referenced by PostUpload(), and ProcessArchiveEntry().
|
staticprivate |
Definition at line 98 of file sync_union_tarball.h.
Referenced by Initialize().
|
private |
directory that we know already exist
Definition at line 73 of file sync_union_tarball.h.
Referenced by CreateDirectories(), and ProcessArchiveEntry().
|
private |
Conditional variable to keep track of when is possible to read the tar file
Definition at line 96 of file sync_union_tarball.h.
Referenced by ProcessArchiveEntry(), Traverse(), and ~SyncUnionTarball().
|
private |
Definition at line 65 of file sync_union_tarball.h.
Referenced by Initialize(), ProcessArchiveEntry(), and Traverse().
|
private |
Definition at line 66 of file sync_union_tarball.h.
Referenced by Initialize().
|
private |
directories where we found catalog marker, after the main traverse we iterate through them and we add the catalog
Definition at line 79 of file sync_union_tarball.h.
Referenced by ProcessArchiveEntry(), and Traverse().
|
private |
entity to delete before to extract the tar
Definition at line 70 of file sync_union_tarball.h.
Referenced by Traverse().
|
private |
Definition at line 68 of file sync_union_tarball.h.
Referenced by CreateDirectories(), and ProcessArchiveEntry().