CernVM-FS
2.12.0
|
#include <sync_mediator.h>
Public Member Functions | |
SyncMediator (catalog::WritableCatalogManager *catalog_manager, const SyncParameters *params, perf::StatisticsTemplate statistics) | |
void | RegisterUnionEngine (SyncUnion *engine) |
~SyncMediator () | |
void | Add (SharedPtr< SyncItem > entry) |
void | Touch (SharedPtr< SyncItem > entry) |
void | Remove (SharedPtr< SyncItem > entry) |
void | Replace (SharedPtr< SyncItem > entry) |
void | Clone (const std::string from, const std::string to) |
void | AddUnmaterializedDirectory (SharedPtr< SyncItem > entry) |
void | EnterDirectory (SharedPtr< SyncItem > entry) |
void | LeaveDirectory (SharedPtr< SyncItem > entry) |
bool | Commit (manifest::Manifest *manifest) |
bool | IsExternalData () const |
bool | IsDirectIo () const |
zlib::Algorithms | GetCompressionAlgorithm () const |
Public Member Functions inherited from publish::AbstractSyncMediator | |
virtual | ~AbstractSyncMediator ()=0 |
Static Public Attributes | |
static const unsigned int | processing_dot_interval = 100 |
Private Types | |
typedef std::stack < HardlinkGroupMap > | HardlinkGroupMapStack |
typedef std::vector < HardlinkGroup > | HardlinkGroupList |
Private Member Functions | |
void | EnsureAllowed (SharedPtr< SyncItem > entry) |
void | AddFile (SharedPtr< SyncItem > entry) |
void | RemoveFile (SharedPtr< SyncItem > entry) |
void | AddDirectory (SharedPtr< SyncItem > entry) |
void | RemoveDirectory (SharedPtr< SyncItem > entry) |
void | TouchDirectory (SharedPtr< SyncItem > entry) |
void | CreateNestedCatalog (SharedPtr< SyncItem > directory) |
void | RemoveNestedCatalog (SharedPtr< SyncItem > directory) |
void | TouchDirectoryRecursively (SharedPtr< SyncItem > entry) |
void | TouchingFileCallback (const std::string &parent_dir, const std::string &file_name) |
void | TouchingSymlinkCallback (const std::string &parent_dir, const std::string &link_name) |
void | TouchDirectoryCallback (const std::string &parent_dir, const std::string &dir_name) |
void | RemoveDirectoryRecursively (SharedPtr< SyncItem > entry) |
void | RemoveFileCallback (const std::string &parent_dir, const std::string &file_name) |
void | RemoveSymlinkCallback (const std::string &parent_dir, const std::string &link_name) |
void | RemoveCharacterDeviceCallback (const std::string &parent_dir, const std::string &link_name) |
void | RemoveBlockDeviceCallback (const std::string &parent_dir, const std::string &link_name) |
void | RemoveFifoCallback (const std::string &parent_dir, const std::string &link_name) |
void | RemoveSocketCallback (const std::string &parent_dir, const std::string &link_name) |
void | RemoveDirectoryCallback (const std::string &parent_dir, const std::string &dir_name) |
bool | IgnoreFileCallback (const std::string &parent_dir, const std::string &file_name) |
void | EnterAddedDirectoryCallback (const std::string &parent_dir, const std::string &dir_name) |
void | LeaveAddedDirectoryCallback (const std::string &parent_dir, const std::string &dir_name) |
void | AddDirectoryRecursively (SharedPtr< SyncItem > entry) |
bool | AddDirectoryCallback (const std::string &parent_dir, const std::string &dir_name) |
void | AddFileCallback (const std::string &parent_dir, const std::string &file_name) |
void | AddCharacterDeviceCallback (const std::string &parent_dir, const std::string &file_name) |
void | AddBlockDeviceCallback (const std::string &parent_dir, const std::string &file_name) |
void | AddFifoCallback (const std::string &parent_dir, const std::string &file_name) |
void | AddSocketCallback (const std::string &parent_dir, const std::string &file_name) |
void | AddSymlinkCallback (const std::string &parent_dir, const std::string &link_name) |
SharedPtr< SyncItem > | CreateSyncItem (const std::string &relative_parent_path, const std::string &filename, const SyncItemType entry_type) const |
void | PublishFilesCallback (const upload::SpoolerResult &result) |
void | PublishHardlinksCallback (const upload::SpoolerResult &result) |
void | CompleteHardlinks (SharedPtr< SyncItem > entry) |
HardlinkGroupMap & | GetHardlinkMap () |
void | LegacyRegularHardlinkCallback (const std::string &parent_dir, const std::string &file_name) |
void | LegacySymlinkHardlinkCallback (const std::string &parent_dir, const std::string &file_name) |
void | LegacyCharacterDeviceHardlinkCallback (const std::string &parent_dir, const std::string &file_name) |
void | LegacyBlockDeviceHardlinkCallback (const std::string &parent_dir, const std::string &file_name) |
void | LegacyFifoHardlinkCallback (const std::string &parent_dir, const std::string &file_name) |
void | LegacySocketHardlinkCallback (const std::string &parent_dir, const std::string &file_name) |
void | InsertLegacyHardlink (SharedPtr< SyncItem > entry) |
uint64_t | GetTemporaryHardlinkGroupNumber (SharedPtr< SyncItem > entry) const |
void | InsertHardlink (SharedPtr< SyncItem > entry) |
void | AddLocalHardlinkGroups (const HardlinkGroupMap &hardlinks) |
void | AddHardlinkGroup (const HardlinkGroup &group) |
Private Attributes | |
catalog::WritableCatalogManager * | catalog_manager_ |
SyncUnion * | union_engine_ |
bool | handle_hardlinks_ |
HardlinkGroupMapStack | hardlink_stack_ |
pthread_mutex_t | lock_file_queue_ |
SyncItemList | file_queue_ |
HardlinkGroupList | hardlink_queue_ |
const SyncParameters * | params_ |
unsigned int | changed_items_ |
XattrList | default_xattrs_ |
UniquePtr< perf::FsCounters > | counters_ |
UniquePtr< SyncDiffReporter > | reporter_ |
The SyncMediator refines the input received from a concrete UnionSync object. For example, it resolves the insertion and deletion of complete directories by recursing them. It works as a mediator between the union file system and forwards the correct database commands to the catalog handler to sync the changes into the repository. Furthermore it sends new and modified files to the spooler for compression and hashing.
Definition at line 148 of file sync_mediator.h.
|
private |
Definition at line 182 of file sync_mediator.h.
|
private |
Definition at line 181 of file sync_mediator.h.
publish::SyncMediator::SyncMediator | ( | catalog::WritableCatalogManager * | catalog_manager, |
const SyncParameters * | params, | ||
perf::StatisticsTemplate | statistics | ||
) |
publish::SyncMediator::~SyncMediator | ( | ) |
Definition at line 56 of file sync_mediator.cc.
Add an entry to the repository. Added directories will be traversed in order to add the complete subtree.
Implements publish::AbstractSyncMediator.
Definition at line 90 of file sync_mediator.cc.
Referenced by AddBlockDeviceCallback(), AddCharacterDeviceCallback(), AddFifoCallback(), AddFileCallback(), AddSocketCallback(), AddSymlinkCallback(), and Replace().
|
private |
Definition at line 583 of file sync_mediator.cc.
Referenced by AddDirectoryRecursively().
|
private |
Definition at line 575 of file sync_mediator.cc.
Referenced by AddDirectoryRecursively().
Definition at line 1020 of file sync_mediator.cc.
Referenced by AddDirectoryCallback(), AddDirectoryRecursively(), and AddUnmaterializedDirectory().
|
private |
Definition at line 558 of file sync_mediator.cc.
Referenced by AddDirectoryRecursively().
Definition at line 537 of file sync_mediator.cc.
Referenced by Add().
|
private |
Definition at line 591 of file sync_mediator.cc.
Referenced by AddDirectoryRecursively().
Definition at line 928 of file sync_mediator.cc.
Referenced by Add().
|
private |
Definition at line 567 of file sync_mediator.cc.
Referenced by AddDirectoryRecursively().
|
private |
Definition at line 1136 of file sync_mediator.cc.
Referenced by AddLocalHardlinkGroups(), and Commit().
|
private |
All hardlinks in the current directory have been picked up. Now they are added to the catalogs.
Definition at line 1102 of file sync_mediator.cc.
Referenced by LeaveDirectory().
|
private |
Definition at line 598 of file sync_mediator.cc.
Referenced by AddDirectoryRecursively().
|
private |
Definition at line 605 of file sync_mediator.cc.
Referenced by AddDirectoryRecursively().
Implements publish::AbstractSyncMediator.
Definition at line 1016 of file sync_mediator.cc.
|
virtual |
Implements publish::AbstractSyncMediator.
Definition at line 264 of file sync_mediator.cc.
|
virtual |
Do any pending processing and commit all changes to the catalogs. To be called after change set traversal is finished.
Implements publish::AbstractSyncMediator.
Definition at line 294 of file sync_mediator.cc.
Referenced by swissknife::Ingest::Main(), swissknife::CommandSync::Main(), and publish::Sync().
Create a recursion engine which DOES NOT recurse into directories. It basically goes through the current directory (in the union volume) and searches for legacy hardlinks which has to be connected to the new or edited ones.
Definition at line 462 of file sync_mediator.cc.
Referenced by LeaveDirectory().
Definition at line 813 of file sync_mediator.cc.
Referenced by AddDirectory(), and TouchDirectory().
|
private |
Definition at line 721 of file sync_mediator.cc.
Referenced by AddBlockDeviceCallback(), AddCharacterDeviceCallback(), AddDirectoryCallback(), AddFifoCallback(), AddFileCallback(), AddSocketCallback(), AddSymlinkCallback(), EnterAddedDirectoryCallback(), IgnoreFileCallback(), LeaveAddedDirectoryCallback(), LegacyBlockDeviceHardlinkCallback(), LegacyCharacterDeviceHardlinkCallback(), LegacyFifoHardlinkCallback(), LegacyRegularHardlinkCallback(), LegacySocketHardlinkCallback(), LegacySymlinkHardlinkCallback(), RemoveBlockDeviceCallback(), RemoveCharacterDeviceCallback(), RemoveDirectoryCallback(), RemoveFifoCallback(), RemoveFileCallback(), RemoveSocketCallback(), and RemoveSymlinkCallback().
The entry /.cvmfs or entries in /.cvmfs/ must not be added, removed or modified manually. The directory /.cvmfs is generated by the VirtualCatalog class if requested.
Definition at line 72 of file sync_mediator.cc.
Referenced by Add(), Remove(), and Touch().
|
private |
Definition at line 614 of file sync_mediator.cc.
Referenced by AddDirectoryRecursively().
Implements publish::AbstractSyncMediator.
Definition at line 268 of file sync_mediator.cc.
Referenced by EnterAddedDirectoryCallback().
|
inlinevirtual |
Implements publish::AbstractSyncMediator.
Definition at line 176 of file sync_mediator.h.
|
inlineprivate |
Definition at line 251 of file sync_mediator.h.
Referenced by CompleteHardlinks(), InsertHardlink(), InsertLegacyHardlink(), and LeaveDirectory().
|
private |
|
private |
Definition at line 709 of file sync_mediator.cc.
Referenced by AddDirectoryRecursively().
Definition at line 387 of file sync_mediator.cc.
Referenced by Add().
Definition at line 414 of file sync_mediator.cc.
Referenced by LegacyBlockDeviceHardlinkCallback(), LegacyCharacterDeviceHardlinkCallback(), LegacyFifoHardlinkCallback(), LegacyRegularHardlinkCallback(), LegacySocketHardlinkCallback(), and LegacySymlinkHardlinkCallback().
|
inlinevirtual |
Implements publish::AbstractSyncMediator.
Definition at line 175 of file sync_mediator.h.
|
inlinevirtual |
Implements publish::AbstractSyncMediator.
Definition at line 174 of file sync_mediator.h.
|
private |
Definition at line 622 of file sync_mediator.cc.
Referenced by AddDirectoryRecursively().
Implements publish::AbstractSyncMediator.
Definition at line 278 of file sync_mediator.cc.
Referenced by LeaveAddedDirectoryCallback().
|
private |
Definition at line 512 of file sync_mediator.cc.
Referenced by CompleteHardlinks().
|
private |
Definition at line 503 of file sync_mediator.cc.
Referenced by CompleteHardlinks().
|
private |
Definition at line 521 of file sync_mediator.cc.
Referenced by CompleteHardlinks().
|
private |
Definition at line 487 of file sync_mediator.cc.
Referenced by CompleteHardlinks().
|
private |
Definition at line 528 of file sync_mediator.cc.
Referenced by CompleteHardlinks().
|
private |
Definition at line 495 of file sync_mediator.cc.
Referenced by CompleteHardlinks().
|
private |
Definition at line 728 of file sync_mediator.cc.
Referenced by SyncMediator().
|
private |
Definition at line 776 of file sync_mediator.cc.
Referenced by Commit().
|
virtual |
Implements publish::AbstractSyncMediator.
Definition at line 61 of file sync_mediator.cc.
Remove an entry from the repository. Directories will be recursively removed.
Implements publish::AbstractSyncMediator.
Definition at line 230 of file sync_mediator.cc.
Referenced by InsertLegacyHardlink(), RemoveBlockDeviceCallback(), RemoveCharacterDeviceCallback(), RemoveFifoCallback(), RemoveFileCallback(), RemoveSocketCallback(), RemoveSymlinkCallback(), and Replace().
|
private |
Definition at line 677 of file sync_mediator.cc.
Referenced by RemoveDirectoryRecursively().
|
private |
Definition at line 668 of file sync_mediator.cc.
Referenced by RemoveDirectoryRecursively().
this method deletes a single directory entry! Make sure to empty it before you call this method or simply use SyncMediator::RemoveDirectoryRecursively instead.
Definition at line 1056 of file sync_mediator.cc.
Referenced by RemoveDirectoryRecursively().
|
private |
Definition at line 701 of file sync_mediator.cc.
Referenced by RemoveDirectoryRecursively().
Definition at line 630 of file sync_mediator.cc.
Referenced by Remove(), and RemoveDirectoryCallback().
|
private |
Definition at line 686 of file sync_mediator.cc.
Referenced by RemoveDirectoryRecursively().
Definition at line 995 of file sync_mediator.cc.
Referenced by Remove().
|
private |
Definition at line 652 of file sync_mediator.cc.
Referenced by RemoveDirectoryRecursively().
Definition at line 823 of file sync_mediator.cc.
Referenced by RemoveDirectory(), and TouchDirectory().
|
private |
Definition at line 693 of file sync_mediator.cc.
Referenced by RemoveDirectoryRecursively().
|
private |
Definition at line 660 of file sync_mediator.cc.
Referenced by RemoveDirectoryRecursively().
Remove the old entry and add the new one.
Implements publish::AbstractSyncMediator.
Definition at line 258 of file sync_mediator.cc.
Referenced by Touch().
Touch an entry in the repository.
Implements publish::AbstractSyncMediator.
Definition at line 169 of file sync_mediator.cc.
Definition at line 1071 of file sync_mediator.cc.
Referenced by Touch().
|
private |
|
private |
|
private |
|
private |
Definition at line 271 of file sync_mediator.h.
Referenced by AddDirectory(), AddFile(), AddHardlinkGroup(), Clone(), Commit(), CreateNestedCatalog(), PublishFilesCallback(), RemoveDirectory(), RemoveFile(), RemoveNestedCatalog(), and TouchDirectory().
|
mutableprivate |
Definition at line 295 of file sync_mediator.h.
|
private |
Definition at line 301 of file sync_mediator.h.
Referenced by AddDirectory(), AddFile(), InsertHardlink(), RemoveDirectory(), RemoveFile(), SyncMediator(), and Touch().
|
private |
By default, files have no extended attributes.
Definition at line 300 of file sync_mediator.h.
Referenced by AddDirectory(), AddFile(), AddHardlinkGroup(), PublishFilesCallback(), and TouchDirectory().
|
private |
Definition at line 290 of file sync_mediator.h.
Referenced by AddFile(), and PublishFilesCallback().
|
private |
Definition at line 274 of file sync_mediator.h.
Referenced by Add(), AddHardlinkGroup(), AddLocalHardlinkGroups(), Commit(), CompleteHardlinks(), EnterDirectory(), InsertHardlink(), InsertLegacyHardlink(), LeaveDirectory(), RegisterUnionEngine(), and RemoveFile().
|
private |
Definition at line 292 of file sync_mediator.h.
Referenced by AddLocalHardlinkGroups(), Commit(), and PublishHardlinksCallback().
|
private |
Hardlinks are supported as long as they all reside in the same directory. If a recursion enters a directory, we push an empty HardlinkGroupMap to keep track of the hardlinks of this directory. When leaving a directory (i.e. it is completely processed) the stack is popped and the HardlinkGroupMap is processed.
Definition at line 283 of file sync_mediator.h.
Referenced by EnterDirectory(), GetHardlinkMap(), and LeaveDirectory().
|
private |
New and modified files are sent to an external spooler for hashing and compression. A spooler callback adds them to the catalogs, once processed.
Definition at line 289 of file sync_mediator.h.
Referenced by AddFile(), PublishFilesCallback(), SyncMediator(), and ~SyncMediator().
|
private |
Definition at line 294 of file sync_mediator.h.
Referenced by Add(), AddDirectory(), AddFile(), AddHardlinkGroup(), AddLocalHardlinkGroups(), Commit(), CreateNestedCatalog(), GetCompressionAlgorithm(), IsDirectIo(), IsExternalData(), PublishFilesCallback(), RemoveDirectory(), RemoveFile(), RemoveNestedCatalog(), and TouchDirectory().
|
static |
Definition at line 150 of file sync_mediator.h.
|
private |
Definition at line 303 of file sync_mediator.h.
Referenced by AddDirectory(), AddFile(), AddLocalHardlinkGroups(), Commit(), CreateNestedCatalog(), RemoveDirectory(), RemoveFile(), RemoveNestedCatalog(), and TouchDirectory().
|
private |
Definition at line 272 of file sync_mediator.h.
Referenced by Add(), AddDirectoryRecursively(), Commit(), CompleteHardlinks(), CreateSyncItem(), IgnoreFileCallback(), RegisterUnionEngine(), and RemoveDirectoryRecursively().