![]() |
CernVM-FS
2.12.0
|
#include <sync_item.h>
Classes | |
struct | EntryStat |
Public Member Functions | |
SyncItem () | |
virtual | ~SyncItem () |
bool | IsDirectory () const |
bool | WasDirectory () const |
bool | IsRegularFile () const |
bool | WasRegularFile () const |
bool | IsSymlink () const |
bool | WasSymlink () const |
bool | IsNew () const |
bool | IsTouched () const |
bool | IsCharacterDevice () const |
bool | IsBlockDevice () const |
bool | IsFifo () const |
bool | IsSocket () const |
bool | IsGraftMarker () const |
bool | IsExternalData () const |
bool | IsDirectIo () const |
bool | IsWhiteout () const |
bool | IsCatalogMarker () const |
bool | IsOpaqueDirectory () const |
bool | IsSpecialFile () const |
bool | WasSpecialFile () const |
bool | IsBundleSpec () const |
bool | WasBundleSpec () const |
unsigned int | GetRdevMajor () const |
unsigned int | GetRdevMinor () const |
bool | HasCatalogMarker () const |
bool | HasGraftMarker () const |
bool | HasCompressionAlgorithm () const |
bool | IsValidGraft () const |
bool | IsChunkedGraft () const |
const FileChunkList * | GetGraftChunks () const |
shash::Any | GetContentHash () const |
void | SetContentHash (const shash::Any &hash) |
bool | HasContentHash () const |
void | SetExternalData (bool val) |
void | SetDirectIo (bool val) |
zlib::Algorithms | GetCompressionAlgorithm () const |
void | SetCompressionAlgorithm (const zlib::Algorithms &alg) |
virtual catalog::DirectoryEntryBase | CreateBasicCatalogDirent (bool enable_mtime_ns) const =0 |
std::string | GetRelativePath () const |
std::string | GetRdOnlyPath () const |
std::string | GetUnionPath () const |
std::string | GetScratchPath () const |
void | MarkAsWhiteout (const std::string &actual_filename) |
void | MarkAsOpaqueDirectory () |
void | MaskHardlink () |
bool | HasHardlinks () const |
unsigned int | GetRdOnlyLinkcount () const |
uint64_t | GetRdOnlyInode () const |
unsigned int | GetUnionLinkcount () const |
uint64_t | GetUnionInode () const |
uint64_t | GetScratchSize () const |
uint64_t | GetRdOnlySize () const |
std::string | filename () const |
std::string | relative_parent_path () const |
virtual IngestionSource * | CreateIngestionSource () const =0 |
virtual void | MakePlaceholderDirectory () const =0 |
void | SetCatalogMarker () |
bool | operator== (const SyncItem &other) const |
Protected Member Functions | |
SyncItem (const std::string &relative_parent_path, const std::string &filename, const SyncUnion *union_engine, const SyncItemType entry_type) | |
platform_stat64 | GetUnionStat () const |
SyncItemType | GetRdOnlyFiletype () const |
SyncItemType | GetUnionFiletype () const |
virtual SyncItemType | GetScratchFiletype () const =0 |
virtual bool | IsType (const SyncItemType expected_type) const =0 |
bool | WasType (const SyncItemType expected_type) const |
SyncItemType | GetGenericFiletype (const EntryStat &stat) const |
void | CheckMarkerFiles () |
Static Protected Member Functions | |
static void | StatGeneric (const std::string &path, EntryStat *info, const bool refresh) |
Protected Attributes | |
SyncItemType | rdonly_type_ |
EntryStat | scratch_stat_ |
ssize_t | graft_size_ |
shash::Any | content_hash_ |
SyncItemType | scratch_type_ |
Private Member Functions | |
void | CheckCatalogMarker () |
std::string | GetGraftMarkerPath () const |
void | CheckGraft () |
void | StatRdOnly (const bool refresh=false) const |
void | StatUnion (const bool refresh=false) const |
virtual void | StatScratch (const bool refresh) const =0 |
Private Attributes | |
std::string | filename_ |
const SyncUnion * | union_engine_ |
EntryStat | rdonly_stat_ |
EntryStat | union_stat_ |
bool | whiteout_ |
bool | opaque_ |
bool | masked_hardlink_ |
bool | has_catalog_marker_ |
bool | valid_graft_ |
bool | graft_marker_present_ |
bool | external_data_ |
bool | direct_io_ |
std::string | relative_parent_path_ |
FileChunkList * | graft_chunklist_ |
zlib::Algorithms | compression_algorithm_ |
bool | has_compression_algorithm_ |
Every directory entry emitted by the FileSystemTraversal is wrapped in a SyncItem structure by the factory method SyncUnion::CreateSyncItem().
Since we are dealing with a union file system setup, this class represents potentially three concrete files:
This class caches stat calls to the underlying files in different branches of the union file system and hides some interpretation details.
Definition at line 56 of file sync_item.h.
publish::SyncItem::SyncItem | ( | ) |
Definition at line 25 of file sync_item.cc.
|
virtual |
Definition at line 66 of file sync_item.cc.
|
protected |
create a new SyncItem Note: SyncItems cannot be created by any using code. SyncUnion will take care of their creating through a factory method to make sure they are initialised correctly (whiteout, hardlink handling, ...)
dirPath | the RELATIVE path to the file |
filename | the name of the file ;-) |
entryType | well... |
Definition at line 42 of file sync_item.cc.
|
private |
Definition at line 282 of file sync_item.cc.
Referenced by CheckMarkerFiles().
|
private |
Definition at line 306 of file sync_item.cc.
Referenced by CheckMarkerFiles().
|
protected |
Definition at line 274 of file sync_item.cc.
Referenced by publish::SyncItemNative::SyncItemNative().
|
pure virtual |
Generates a DirectoryEntry that can be directly stored into a catalog db. Note: this sets the inode fields to kInvalidInode as well as the link count to 1 if MaskHardlink() has been called before (cf. OverlayFS)
If nanosecond timestamps are off, the directory entry will have a default initialized, negative nanosecond timestamp and as a result the corresponding field in the catalog table will be NULL.
Implemented in publish::SyncItemNative, publish::SyncItemDummyDir, publish::SyncItemDummyCatalog, and publish::SyncItemTar.
|
pure virtual |
Implemented in publish::SyncItemNative, publish::SyncItemDummyCatalog, and publish::SyncItemTar.
|
inline |
Definition at line 180 of file sync_item.h.
Referenced by publish::SyncItemTar::CreateBasicCatalogDirent(), publish::SyncItemDummyDir::CreateBasicCatalogDirent(), publish::SyncItemNative::CreateBasicCatalogDirent(), and publish::SyncItemNative::IsType().
|
inline |
Definition at line 127 of file sync_item.h.
Referenced by publish::SyncItemTar::CreateBasicCatalogDirent(), publish::SyncItemDummyCatalog::CreateBasicCatalogDirent(), publish::SyncItemDummyDir::CreateBasicCatalogDirent(), and publish::SyncItemNative::CreateBasicCatalogDirent().
|
inline |
Definition at line 121 of file sync_item.h.
Referenced by publish::SyncItemTar::CreateBasicCatalogDirent(), publish::SyncItemDummyCatalog::CreateBasicCatalogDirent(), publish::SyncItemDummyDir::CreateBasicCatalogDirent(), and publish::SyncItemNative::CreateBasicCatalogDirent().
|
protected |
Definition at line 71 of file sync_item.cc.
Referenced by GetRdOnlyFiletype(), publish::SyncItemNative::GetScratchFiletype(), and GetUnionFiletype().
|
inline |
Definition at line 120 of file sync_item.h.
|
private |
Definition at line 298 of file sync_item.cc.
Referenced by CheckGraft().
|
inline |
Definition at line 104 of file sync_item.h.
Referenced by publish::SyncItemNative::CreateBasicCatalogDirent().
|
inline |
Definition at line 109 of file sync_item.h.
Referenced by publish::SyncItemNative::CreateBasicCatalogDirent().
|
protected |
Definition at line 83 of file sync_item.cc.
Referenced by IsTouched(), MarkAsWhiteout(), and WasType().
uint64_t publish::SyncItem::GetRdOnlyInode | ( | ) | const |
unsigned int publish::SyncItem::GetRdOnlyLinkcount | ( | ) | const |
std::string publish::SyncItem::GetRdOnlyPath | ( | ) | const |
Definition at line 255 of file sync_item.cc.
Referenced by StatRdOnly().
uint64_t publish::SyncItem::GetRdOnlySize | ( | ) | const |
|
inline |
Definition at line 149 of file sync_item.h.
Referenced by GetGenericFiletype(), GetRdOnlyPath(), publish::SyncItemNative::GetScratchFiletype(), GetScratchPath(), GetUnionPath(), and MarkAsWhiteout().
|
protectedpure virtual |
Implemented in publish::SyncItemNative, publish::SyncItemDummyDir, publish::SyncItemDummyCatalog, and publish::SyncItemTar.
Referenced by IsTouched().
std::string publish::SyncItem::GetScratchPath | ( | ) | const |
Definition at line 267 of file sync_item.cc.
Referenced by publish::SyncItemNative::StatScratch().
uint64_t publish::SyncItem::GetScratchSize | ( | ) | const |
|
protected |
Definition at line 108 of file sync_item.cc.
Referenced by IsTouched().
uint64_t publish::SyncItem::GetUnionInode | ( | ) | const |
unsigned int publish::SyncItem::GetUnionLinkcount | ( | ) | const |
Definition at line 169 of file sync_item.cc.
Referenced by HasHardlinks().
std::string publish::SyncItem::GetUnionPath | ( | ) | const |
Definition at line 261 of file sync_item.cc.
Referenced by CheckCatalogMarker(), publish::SyncItemNative::CreateBasicCatalogDirent(), publish::SyncItemTar::CreateIngestionSource(), publish::SyncItemDummyCatalog::CreateIngestionSource(), publish::SyncItemNative::CreateIngestionSource(), and StatUnion().
|
inlineprotected |
Definition at line 210 of file sync_item.h.
Referenced by publish::SyncItemNative::CreateBasicCatalogDirent().
|
inline |
Definition at line 114 of file sync_item.h.
|
inline |
Definition at line 116 of file sync_item.h.
|
inline |
|
inline |
Definition at line 115 of file sync_item.h.
|
inline |
Definition at line 169 of file sync_item.h.
Referenced by publish::SyncItemNative::CreateBasicCatalogDirent().
|
inline |
Definition at line 77 of file sync_item.h.
Referenced by publish::SyncItemTar::CreateBasicCatalogDirent(), publish::SyncItemNative::CreateBasicCatalogDirent(), and IsSpecialFile().
|
inline |
Definition at line 97 of file sync_item.h.
|
inline |
Definition at line 85 of file sync_item.h.
|
inline |
Definition at line 76 of file sync_item.h.
Referenced by publish::SyncItemTar::CreateBasicCatalogDirent(), publish::SyncItemNative::CreateBasicCatalogDirent(), and IsSpecialFile().
|
inline |
Definition at line 118 of file sync_item.h.
|
inline |
Definition at line 82 of file sync_item.h.
Referenced by publish::SyncItemNative::CreateBasicCatalogDirent().
|
inline |
Definition at line 64 of file sync_item.h.
Referenced by CheckMarkerFiles(), publish::SyncItemTar::GetStatFromTar(), IsOpaqueDirectory(), and MarkAsOpaqueDirectory().
|
inline |
Definition at line 81 of file sync_item.h.
Referenced by publish::SyncItemTar::CreateBasicCatalogDirent(), publish::SyncItemDummyDir::CreateBasicCatalogDirent(), and publish::SyncItemNative::CreateBasicCatalogDirent().
|
inline |
Definition at line 78 of file sync_item.h.
Referenced by IsSpecialFile().
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 66 of file sync_item.h.
Referenced by CheckMarkerFiles().
|
inline |
Definition at line 79 of file sync_item.h.
Referenced by IsSpecialFile().
|
inline |
Definition at line 88 of file sync_item.h.
Referenced by GetRdevMajor(), and GetRdevMinor().
|
inline |
Definition at line 68 of file sync_item.h.
Referenced by publish::SyncItemTar::CreateBasicCatalogDirent(), and publish::SyncItemNative::CreateBasicCatalogDirent().
|
inline |
|
protectedpure virtual |
Checks if the SyncItem is the given file type (file, dir, symlink, ...) in the union file system volume. Hence: After the publish operation, the file will be this type in CVMFS.
expected_type | the file type to be checked against |
Implemented in publish::SyncItemNative, publish::SyncItemTar, and publish::SyncItemDummyCatalog.
Referenced by IsBlockDevice(), IsCharacterDevice(), IsDirectory(), IsFifo(), IsGraftMarker(), IsRegularFile(), IsSocket(), and IsSymlink().
|
inline |
Definition at line 117 of file sync_item.h.
|
inline |
Definition at line 84 of file sync_item.h.
|
pure virtual |
Implemented in publish::SyncItemNative, publish::SyncItemDummyDir, publish::SyncItemDummyCatalog, and publish::SyncItemTar.
void publish::SyncItem::MarkAsOpaqueDirectory | ( | ) |
void publish::SyncItem::MarkAsWhiteout | ( | const std::string & | actual_filename | ) |
|
inline |
Union file systems (i.e. OverlayFS) might not properly support hardlinks, forcing us to ignore them during publishing. A 'masked hardlink' will be treated as a normal file (linkcount == 1). Hence, any created hardlinks will be broken up into individual files with differing inodes.
Definition at line 168 of file sync_item.h.
|
inline |
Definition at line 189 of file sync_item.h.
|
inline |
Definition at line 181 of file sync_item.h.
|
inline |
Definition at line 187 of file sync_item.h.
|
inline |
Definition at line 130 of file sync_item.h.
Referenced by CheckGraft().
|
inline |
Definition at line 122 of file sync_item.h.
Referenced by publish::SyncMediator::PublishFilesCallback().
|
inline |
Definition at line 125 of file sync_item.h.
|
inline |
Definition at line 124 of file sync_item.h.
|
staticprotected |
Definition at line 194 of file sync_item.cc.
Referenced by CheckCatalogMarker(), StatRdOnly(), publish::SyncItemNative::StatScratch(), and StatUnion().
|
inlineprivate |
Definition at line 319 of file sync_item.h.
Referenced by GetRdOnlyFiletype(), GetRdOnlyInode(), GetRdOnlyLinkcount(), GetRdOnlySize(), and MarkAsWhiteout().
|
privatepure virtual |
Implemented in publish::SyncItemNative, publish::SyncItemDummyCatalog, and publish::SyncItemTar.
Referenced by GetScratchSize(), and MarkAsWhiteout().
|
inlineprivate |
Definition at line 322 of file sync_item.h.
Referenced by GetRdevMajor(), GetRdevMinor(), GetUnionFiletype(), GetUnionInode(), GetUnionLinkcount(), and GetUnionStat().
|
inline |
Definition at line 100 of file sync_item.h.
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprotected |
Checks if the SyncItem was the given file type (file, dir, symlink, ...) in CVMFS (or the lower layer of the union file system). Hence: Before the current transaction the file was this type in CVMFS.
expected_type | the file type to be checked against |
Definition at line 236 of file sync_item.h.
Referenced by IsNew(), WasDirectory(), WasRegularFile(), WasSpecialFile(), and WasSymlink().
|
private |
Definition at line 314 of file sync_item.h.
Referenced by GetCompressionAlgorithm(), and SetCompressionAlgorithm().
|
protected |
Definition at line 280 of file sync_item.h.
Referenced by CheckGraft(), GetContentHash(), HasContentHash(), SetContentHash(), and SyncItem().
|
private |
Definition at line 305 of file sync_item.h.
Referenced by IsDirectIo(), and SetDirectIo().
|
private |
Definition at line 304 of file sync_item.h.
Referenced by IsExternalData(), and SetExternalData().
|
private |
Definition at line 287 of file sync_item.h.
Referenced by filename(), GetGraftMarkerPath(), GetRelativePath(), IsBundleSpec(), IsCatalogMarker(), MarkAsWhiteout(), operator==(), and WasBundleSpec().
|
private |
Chunklist from graft. Not initialized by default to save memory.
Definition at line 311 of file sync_item.h.
Referenced by CheckGraft(), GetGraftChunks(), IsChunkedGraft(), and ~SyncItem().
|
private |
.cvmfsgraft-$filename exists
Definition at line 302 of file sync_item.h.
Referenced by CheckGraft(), and HasGraftMarker().
|
protected |
Definition at line 277 of file sync_item.h.
Referenced by CheckGraft(), and publish::SyncItemNative::CreateBasicCatalogDirent().
|
private |
directory containing .cvmfscatalog
Definition at line 300 of file sync_item.h.
Referenced by CheckCatalogMarker(), HasCatalogMarker(), and SetCatalogMarker().
|
private |
Definition at line 316 of file sync_item.h.
Referenced by HasCompressionAlgorithm(), and SetCompressionAlgorithm().
|
private |
SyncUnion masked out the linkcount
Definition at line 299 of file sync_item.h.
Referenced by HasHardlinks(), and MaskHardlink().
|
private |
SyncUnion marked this as opaque dir
Definition at line 298 of file sync_item.h.
Referenced by IsOpaqueDirectory(), and MarkAsOpaqueDirectory().
|
mutableprivate |
Definition at line 294 of file sync_item.h.
Referenced by GetRdOnlyFiletype(), GetRdOnlyInode(), GetRdOnlyLinkcount(), GetRdOnlySize(), MarkAsWhiteout(), and StatRdOnly().
|
mutableprotected |
Definition at line 274 of file sync_item.h.
Referenced by publish::SyncItemTar::MakePlaceholderDirectory(), publish::SyncItemDummyDir::MakePlaceholderDirectory(), MarkAsWhiteout(), and WasType().
|
private |
Definition at line 306 of file sync_item.h.
Referenced by GetGraftMarkerPath(), GetRelativePath(), operator==(), and relative_parent_path().
|
mutableprotected |
Definition at line 275 of file sync_item.h.
Referenced by publish::SyncItemDummyDir::CreateBasicCatalogDirent(), publish::SyncItemNative::GetScratchFiletype(), GetScratchSize(), publish::SyncItemTar::StatScratch(), publish::SyncItemNative::StatScratch(), and publish::SyncItemDummyDir::SyncItemDummyDir().
|
mutableprotected |
Definition at line 282 of file sync_item.h.
Referenced by publish::SyncItemTar::IsType(), publish::SyncItemNative::IsType(), and MarkAsWhiteout().
|
private |
this SyncUnion created this object
Definition at line 292 of file sync_item.h.
Referenced by GetGraftMarkerPath(), GetRdOnlyPath(), GetScratchPath(), and GetUnionPath().
|
mutableprivate |
Definition at line 295 of file sync_item.h.
Referenced by GetRdevMajor(), GetRdevMinor(), GetUnionFiletype(), GetUnionInode(), GetUnionLinkcount(), GetUnionStat(), and StatUnion().
|
private |
checksum and size in graft marker
Definition at line 301 of file sync_item.h.
Referenced by CheckGraft(), and IsValidGraft().
|
private |
SyncUnion marked this as whiteout
Definition at line 297 of file sync_item.h.
Referenced by IsWhiteout(), and MarkAsWhiteout().