CernVM-FS  2.12.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
catalog::SqlDirent Class Reference

#include <catalog_sql.h>

Inheritance diagram for catalog::SqlDirent:
Collaboration diagram for catalog::SqlDirent:

Static Public Attributes

static const int kFlagDir = 1
 
static const int kFlagDirNestedMountpoint = 2
 
static const int kFlagDirNestedRoot = 32
 
static const int kFlagFile = 4
 
static const int kFlagLink = 8
 
static const int kFlagFileSpecial = 16
 
static const int kFlagFileChunk = 64
 
static const int kFlagFileExternal = 128
 
static const int kFlagPosHash = 8
 
static const int kFlagPosCompression = 11
 
static const int kFlagDirBindMountpoint = 0x4000
 
static const int kFlagHidden = 0x8000
 
static const int kFlagDirectIo = 0x10000
 

Protected Member Functions

unsigned CreateDatabaseFlags (const DirectoryEntry &entry) const
 
void StoreHashAlgorithm (const shash::Algorithms algo, unsigned *flags) const
 
shash::Algorithms RetrieveHashAlgorithm (const unsigned flags) const
 
zlib::Algorithms RetrieveCompressionAlgorithm (const unsigned flags) const
 
uint32_t Hardlinks2Linkcount (const uint64_t hardlinks) const
 
uint32_t Hardlinks2HardlinkGroup (const uint64_t hardlinks) const
 
uint64_t MakeHardlinks (const uint32_t hardlink_group, const uint32_t linkcount) const
 
void ExpandSymlink (LinkString *raw_symlink) const
 
- Protected Member Functions inherited from catalog::SqlCatalog
 SqlCatalog ()
 
- Protected Member Functions inherited from sqlite::Sql
 Sql ()
 
bool IsInitialized () const
 
bool Init (const sqlite3 *database, const std::string &statement)
 
void DeferredInit (const sqlite3 *database, const char *statement)
 
bool Successful () const
 

Additional Inherited Members

- Public Member Functions inherited from catalog::SqlCatalog
 SqlCatalog (const CatalogDatabase &database, const std::string &statement)
 
shash::Md5 RetrieveMd5 (const int idx_high, const int idx_low) const
 
shash::Any RetrieveHashBlob (const int idx_column, const shash::Algorithms hash_algo, const char hash_suffix=shash::kSuffixNone) const
 
shash::Any RetrieveHashHex (const int idx_column, const char hash_suffix=shash::kSuffixNone) const
 
bool BindMd5 (const int idx_high, const int idx_low, const shash::Md5 &hash)
 
bool BindHashBlob (const int idx_column, const shash::Any &hash)
 
- Public Member Functions inherited from sqlite::Sql
 Sql (sqlite3 *sqlite_db, const std::string &statement)
 
virtual ~Sql ()
 
bool Execute ()
 
bool FetchRow ()
 
std::string DebugResultTable ()
 
bool Reset ()
 
int GetLastError () const
 
std::string GetLastErrorMsg () const
 
bool BindBlob (const int index, const void *value, const unsigned size)
 
bool BindBlobTransient (const int index, const void *value, const unsigned size)
 
bool BindDouble (const int index, const double value)
 
bool BindInt (const int index, const int value)
 
bool BindInt64 (const int index, const sqlite3_int64 value)
 
bool BindNull (const int index)
 
bool BindTextTransient (const int index, const std::string &value)
 
bool BindTextTransient (const int index, const char *value, const int size)
 
bool BindText (const int index, const std::string &value)
 
bool BindText (const int index, const char *value, const int size, void(*dtor)(void *)=SQLITE_STATIC)
 
template<typename T >
bool Bind (const int index, const T &value)
 
int RetrieveType (const int idx_column) const
 
int RetrieveBytes (const int idx_column) const
 
const void * RetrieveBlob (const int idx_column) const
 
double RetrieveDouble (const int idx_column) const
 
int RetrieveInt (const int idx_column) const
 
sqlite3_int64 RetrieveInt64 (const int idx_column) const
 
const unsigned char * RetrieveText (const int idx_column) const
 
std::string RetrieveString (const int idx_column) const
 
template<typename T >
Retrieve (const int index)
 
template<>
bool Bind (const int index, const int &value)
 
template<>
bool Bind (const int index, const unsigned int &value)
 
template<>
bool Bind (const int index, const uint64_t &value)
 
template<>
bool Bind (const int index, const sqlite3_int64 &value)
 
template<>
bool Bind (const int index, const std::string &value)
 
template<>
bool Bind (const int index, const float &value)
 
template<>
bool Bind (const int index, const double &value)
 
template<>
int Retrieve (const int index)
 
template<>
bool Retrieve (const int index)
 
template<>
sqlite3_int64 Retrieve (const int index)
 
template<>
uint64_t Retrieve (const int index)
 
template<>
std::string Retrieve (const int index)
 
template<>
float Retrieve (const int index)
 
template<>
double Retrieve (const int index)
 

Detailed Description

Common ancestor of SQL statements that deal with directory entries.

Definition at line 174 of file catalog_sql.h.

Member Function Documentation

unsigned catalog::SqlDirent::CreateDatabaseFlags ( const DirectoryEntry entry) const
protected

Take the meta data from the DirectoryEntry and transform it into a valid flags field ready to be saved in the database.

Parameters
entrythe DirectoryEntry to encode
Returns
an integer containing the bitmap of the flags field

Definition at line 417 of file catalog_sql.cc.

Here is the call graph for this function:

void catalog::SqlDirent::ExpandSymlink ( LinkString raw_symlink) const
protected

Replaces place holder variables in a symbolic link by actual path elements.

Parameters
raw_symlinkthe raw symlink path (may) containing place holders
Returns
the expanded symlink

Expands variant symlinks containing string. Uses the environment variables of the current process (cvmfs2)

Definition at line 504 of file catalog_sql.cc.

Here is the call graph for this function:

uint32_t catalog::SqlDirent::Hardlinks2HardlinkGroup ( const uint64_t  hardlinks) const
protected

Definition at line 487 of file catalog_sql.cc.

uint32_t catalog::SqlDirent::Hardlinks2Linkcount ( const uint64_t  hardlinks) const
protected

The hardlink information (hardlink group ID and linkcount) is saved in one uint_64t field in the CVMFS Catalogs. Therefore we need to do bitshifting in these helper methods.

Definition at line 482 of file catalog_sql.cc.

uint64_t catalog::SqlDirent::MakeHardlinks ( const uint32_t  hardlink_group,
const uint32_t  linkcount 
) const
protected

Definition at line 492 of file catalog_sql.cc.

Here is the call graph for this function:

zlib::Algorithms catalog::SqlDirent::RetrieveCompressionAlgorithm ( const unsigned  flags) const
protected

Definition at line 472 of file catalog_sql.cc.

shash::Algorithms catalog::SqlDirent::RetrieveHashAlgorithm ( const unsigned  flags) const
protected

Definition at line 463 of file catalog_sql.cc.

Here is the call graph for this function:

void catalog::SqlDirent::StoreHashAlgorithm ( const shash::Algorithms  algo,
unsigned *  flags 
) const
protected

Definition at line 454 of file catalog_sql.cc.

Here is the call graph for this function:

Member Data Documentation

const int catalog::SqlDirent::kFlagDirBindMountpoint = 0x4000
static

A transition point to a root catalog (instead of a nested catalog). Used to link previous snapshots into the catalog structure.

Definition at line 207 of file catalog_sql.h.

const int catalog::SqlDirent::kFlagDirectIo = 0x10000
static

For regular files, indicates that the file should be opened with direct I/O

Definition at line 216 of file catalog_sql.h.

const int catalog::SqlDirent::kFlagDirNestedMountpoint = 2
static

Definition at line 180 of file catalog_sql.h.

const int catalog::SqlDirent::kFlagDirNestedRoot = 32
static

Definition at line 182 of file catalog_sql.h.

const int catalog::SqlDirent::kFlagFileExternal = 128
static

The file is not natively stored in cvmfs but on a different storage system, for instance on HTTPS data federation services. NOTE: used as magic number in SqlListContentHashes::SqlListContentHashes

Definition at line 192 of file catalog_sql.h.

Referenced by swissknife::CommandMigrate::StatsMigrationWorker::RepairStatisticsCounters().

const int catalog::SqlDirent::kFlagFileSpecial = 16
static
const int catalog::SqlDirent::kFlagHidden = 0x8000
static

An entry that should not appear in listings. Used for the /.cvmfs directory.

Definition at line 212 of file catalog_sql.h.

const int catalog::SqlDirent::kFlagPosCompression = 11
static

Definition at line 202 of file catalog_sql.h.

const int catalog::SqlDirent::kFlagPosHash = 8
static

Definition at line 199 of file catalog_sql.h.


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