CernVM-FS
2.12.0
|
#include <sync_union.h>
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< 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 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_ |
AbstractSyncMediator * | mediator_ |
Private Attributes | |
bool | initialized_ |
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.
publish::SyncUnion::SyncUnion | ( | AbstractSyncMediator * | mediator, |
const std::string & | rdonly_path, | ||
const std::string & | union_path, | ||
const std::string & | scratch_path | ||
) |
rdonly_path | the absolute path to the mounted cvmfs repository |
union_path | the absolute path to the mounted union file system volume |
scratch_path | the absolute path to the read write branch attached to the union file system |
mediator | a reference to a SyncMediator object used as bridge to the actual sync process |
Definition at line 14 of file sync_union.cc.
|
inlinevirtual |
Definition at line 67 of file sync_union.h.
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).
relative_parent_path | the directory path the SyncItem resides in |
filename | file/directory name of directory entry |
entry_type | type of the item in the union directory |
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().
|
protectedvirtual |
Called if the file system traversal enters a directory for processing.
parent_dir | the relative directory path. |
Definition at line 135 of file sync_union.cc.
Referenced by publish::SyncUnionAufs::Traverse(), and publish::SyncUnionOverlayfs::Traverse().
|
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!
parent | directory in which file resides |
filename | to decide whether to ignore or not |
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().
|
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().
|
inline |
Definition at line 139 of file sync_union.h.
Referenced by publish::SyncUnionAufs::Traverse(), publish::SyncUnionOverlayfs::Traverse(), and publish::SyncUnionTarball::Traverse().
|
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
directory | the directory to check for opacity |
Implemented in publish::SyncUnionTarball, publish::SyncUnionOverlayfs, and publish::SyncUnionAufs.
Referenced by PreprocessSyncItem().
Checks if given file is supposed to be whiteout. These files indicate that a specific file has been deleted.
filename | the filename to check |
Implemented in publish::SyncUnionTarball, publish::SyncUnionOverlayfs, and publish::SyncUnionAufs.
Referenced by PreprocessSyncItem().
|
protectedvirtual |
Called before the file system traversal leaves a processed directory.
parent_dir | the relative directory path. |
Definition at line 141 of file sync_union.cc.
Referenced by publish::SyncUnionAufs::Traverse(), and publish::SyncUnionOverlayfs::Traverse().
|
inlinevirtual |
Reimplemented in publish::SyncUnionTarball.
Definition at line 81 of file sync_union.h.
Referenced by publish::SyncMediator::Commit().
Allow for preprocessing steps before emitting 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.
entry | the 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().
|
protected |
Callback when a block device is found
parent_dir | the relative directory path |
filename | the filename |
Definition at line 157 of file sync_union.cc.
Referenced by publish::SyncUnionAufs::Traverse(), and publish::SyncUnionOverlayfs::Traverse().
|
protected |
Callback when a character device is found
parent_dir | the relative directory path |
filename | the filename |
Definition at line 147 of file sync_union.cc.
Referenced by publish::SyncUnionAufs::Traverse(), and publish::SyncUnionOverlayfs::Traverse().
|
protectedvirtual |
Callback when a directory is found.
parent_dir | the relative directory path |
dir_name | the filename |
Referenced by publish::SyncUnionAufs::Traverse(), publish::SyncUnionOverlayfs::Traverse(), and publish::SyncUnionTarball::Traverse().
|
protected |
Callback when a named pipe is found.
parent_dir | the relative directory path |
filename | the filename |
Definition at line 167 of file sync_union.cc.
Referenced by publish::SyncUnionAufs::Traverse(), and publish::SyncUnionOverlayfs::Traverse().
Called to actually process the file entry.
entry | the 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().
|
protectedvirtual |
Callback when a regular file is found.
parent_dir | the relative directory path |
filename | the filename |
Definition at line 99 of file sync_union.cc.
Referenced by publish::SyncUnionAufs::Traverse(), and publish::SyncUnionOverlayfs::Traverse().
|
protected |
Callback when a unix domain socket is found.
parent_dir | the relative directory path |
filename | the filename |
Definition at line 175 of file sync_union.cc.
Referenced by publish::SyncUnionAufs::Traverse(), and publish::SyncUnionOverlayfs::Traverse().
|
protectedvirtual |
Callback when a symlink is found.
parent_dir | the relative directory path |
link_name | the filename |
Definition at line 107 of file sync_union.cc.
Referenced by publish::SyncUnionAufs::Traverse(), and publish::SyncUnionOverlayfs::Traverse().
|
protectedvirtual |
Definition at line 92 of file sync_union.cc.
Referenced by publish::SyncUnionTarball::CreateDirectories(), and publish::SyncUnionTarball::ProcessArchiveEntry().
|
inline |
Definition at line 96 of file sync_union.h.
Referenced by publish::SyncItem::GetRdOnlyPath(), and publish::SyncMediator::RemoveDirectoryRecursively().
|
inline |
Definition at line 98 of file sync_union.h.
Referenced by publish::SyncMediator::AddDirectoryRecursively(), publish::SyncItem::GetGraftMarkerPath(), publish::SyncItem::GetScratchPath(), publish::SyncUnionAufs::Traverse(), and publish::SyncUnionOverlayfs::Traverse().
|
inlinevirtual |
Reimplemented in publish::SyncUnionAufs.
Definition at line 140 of file sync_union.h.
Referenced by publish::SyncMediator::RegisterUnionEngine().
|
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::Sync().
|
inline |
Definition at line 97 of file sync_union.h.
Referenced by publish::SyncMediator::Add(), publish::SyncMediator::CompleteHardlinks(), and publish::SyncItem::GetUnionPath().
|
pure 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 |
Implemented in publish::SyncUnionTarball, publish::SyncUnionOverlayfs, and publish::SyncUnionAufs.
Referenced by PreprocessSyncItem().
|
private |
Definition at line 240 of file sync_union.h.
Referenced by Initialize(), and IsInitialized().
|
protected |
Definition at line 147 of file sync_union.h.
Referenced by CreateSyncItem(), EnterDirectory(), Initialize(), LeaveDirectory(), publish::SyncUnionTarball::PostUpload(), ProcessDirectory(), ProcessFile(), ProcessUnmaterializedDirectory(), publish::SyncUnionAufs::Traverse(), and publish::SyncUnionTarball::Traverse().
|
protected |
Definition at line 143 of file sync_union.h.
Referenced by rdonly_path().
|
protected |
Definition at line 144 of file sync_union.h.
Referenced by scratch_path().
|
protected |
Definition at line 145 of file sync_union.h.
Referenced by union_path().