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

#include <catalog_mgr_client.h>

Inheritance diagram for catalog::ClientCatalogManager:
Collaboration diagram for catalog::ClientCatalogManager:

Public Member Functions

 ClientCatalogManager (MountPoint *mountpoint)
 
virtual ~ClientCatalogManager ()
 
bool InitFixed (const shash::Any &root_hash, bool alternative_path)
 
shash::Any GetRootHash ()
 
std::string GetCatalogDescription (const PathString &mountpoint, const shash::Any &hash)
 
bool IsRevisionBlacklisted ()
 
bool offline_mode () const
 
uint64_t all_inodes () const
 
uint64_t loaded_inodes () const
 
std::string repo_name () const
 
manifest::Manifestmanifest () const
 
int root_fd () const
 
- Public Member Functions inherited from catalog::AbstractCatalogManager< Catalog >
 AbstractCatalogManager (perf::Statistics *statistics)
 
virtual ~AbstractCatalogManager ()
 
void SetInodeAnnotation (InodeAnnotation *new_annotation)
 
virtual bool Init ()
 
LoadReturn RemountDryrun ()
 
LoadReturn Remount ()
 
LoadReturn ChangeRoot (const shash::Any &root_hash)
 
void DetachNested ()
 
bool LookupPath (const PathString &path, const LookupOptions options, DirectoryEntry *entry)
 
bool LookupPath (const std::string &path, const LookupOptions options, DirectoryEntry *entry)
 
bool LookupXattrs (const PathString &path, XattrList *xattrs)
 
bool LookupNested (const PathString &path, PathString *mountpoint, shash::Any *hash, uint64_t *size)
 
bool ListCatalogSkein (const PathString &path, std::vector< PathString > *result_list)
 
bool Listing (const PathString &path, DirectoryEntryList *listing, const bool expand_symlink)
 
bool Listing (const PathString &path, DirectoryEntryList *listing)
 
bool Listing (const std::string &path, DirectoryEntryList *listing)
 
bool ListingStat (const PathString &path, StatEntryList *listing)
 
bool ListFileChunks (const PathString &path, const shash::Algorithms interpret_hashes_as, FileChunkList *chunks)
 
void SetOwnerMaps (const OwnerMap &uid_map, const OwnerMap &gid_map)
 
void SetCatalogWatermark (unsigned limit)
 
shash::Any GetNestedCatalogHash (const PathString &mountpoint)
 
Statistics statistics () const
 
uint64_t inode_gauge ()
 
bool volatile_flag () const
 
uint64_t GetRevision () const
 
uint64_t GetTimestamp () const
 
uint64_t GetTTL () const
 
bool HasExplicitTTL () const
 
bool GetVOMSAuthz (std::string *authz) const
 
int GetNumCatalogs () const
 
std::string PrintHierarchy () const
 
std::string PrintAllMemStatistics () const
 
inode_t GetRootInode () const
 
CatalogGetRootCatalog () const
 
inode_t MangleInode (const inode_t inode) const
 
catalog::Counters LookupCounters (const PathString &path, std::string *subcatalog_path, shash::Any *hash)
 

Protected Member Functions

virtual LoadReturn GetNewRootCatalogContext (CatalogContext *result)
 
virtual LoadReturn LoadCatalogByHash (CatalogContext *ctlg_context)
 
virtual void StageNestedCatalogByHash (const shash::Any &hash, const PathString &mountpoint)
 
void UnloadCatalog (const catalog::Catalog *catalog)
 
catalog::CatalogCreateCatalog (const PathString &mountpoint, const shash::Any &catalog_hash, catalog::Catalog *parent_catalog)
 
void ActivateCatalog (catalog::Catalog *catalog)
 
- Protected Member Functions inherited from catalog::AbstractCatalogManager< Catalog >
const std::vector< Catalog * > & GetCatalogs () const
 
void StageNestedCatalogAndUnlock (const PathString &path, const Catalog *parent, bool is_listable)
 
CatalogMountCatalog (const PathString &mountpoint, const shash::Any &hash, Catalog *parent_catalog)
 
bool MountSubtree (const PathString &path, const Catalog *entry_point, bool can_listing, Catalog **leaf_catalog)
 
CatalogLoadFreeCatalog (const PathString &mountpoint, const shash::Any &hash)
 
bool AttachCatalog (const std::string &db_path, Catalog *new_catalog)
 
void DetachCatalog (Catalog *catalog)
 
void DetachSubtree (Catalog *catalog)
 
void DetachSiblings (const PathString &current_tree)
 
void DetachAll ()
 
bool IsAttached (const PathString &root_path, Catalog **attached_catalog) const
 
CatalogFindCatalog (const PathString &path) const
 
uint64_t GetRevisionNoLock () const
 
uint64_t GetTimestampNoLock () const
 
void ReadLock () const
 
void WriteLock () const
 
void Unlock () const
 
virtual void EnforceSqliteMemLimit ()
 
- Protected Member Functions inherited from SingleCopy
 SingleCopy ()
 

Private Member Functions

 FRIEND_TEST (T_CatalogManagerClient, MountLatest)
 
 FRIEND_TEST (T_CatalogManagerClient, LoadByHash)
 
 FRIEND_TEST (T_CatalogManagerClient, LoadByHashNetworkFailure)
 
 FRIEND_TEST (T_CatalogManagerClient, LoadRootCatalog)
 
LoadReturn FetchCatalogByHash (const shash::Any &hash, const std::string &name, const std::string &alt_catalog_path, std::string *catalog_path)
 

Private Attributes

std::map< PathString, shash::Anyloaded_catalogs_
 
std::map< PathString, shash::Anymounted_catalogs_
 
UniquePtr< manifest::Manifestmanifest_
 
std::string repo_name_
 
cvmfs::Fetcherfetcher_
 
signature::SignatureManagersignature_mgr_
 
std::string workspace_
 
bool offline_mode_
 
uint64_t all_inodes_
 
uint64_t loaded_inodes_
 
shash::Any fixed_root_catalog_
 
bool fixed_alt_root_catalog_
 
BackoffThrottle backoff_throttle_
 
perf::Countern_certificate_hits_
 
perf::Countern_certificate_misses_
 
int root_fd_
 

Friends

class CachedManifestEnsemble
 

Additional Inherited Members

- Public Types inherited from catalog::AbstractCatalogManager< Catalog >
typedef std::vector< Catalog * > CatalogList
 
typedef Catalog catalog_t
 
- Static Public Attributes inherited from catalog::AbstractCatalogManager< Catalog >
static const inode_t kInodeOffset
 

Detailed Description

A catalog manager that uses a Fetcher to get file catalgs in the form of (virtual) file descriptors from a cache manager. Sqlite has a path based interface. This catalog manager returns <FILE DESCRIPTOR> as a path and thus requires a sqlite vfs that supports this syntax, such as the cvmfs default vfs for clients.

This class uses the Fetcher in order to get access to the download manager and the cache manager, too. It requires a download manager and a signature manager as it calls manifest::Fetch in order to get the manifest of new and updated root catalogs. It requires the cache manager to get access to the Unpin() method of the corresponding quota manager; loaded catalogs need to be unpinned when the class is destructed.

Definition at line 50 of file catalog_mgr_client.h.

Constructor & Destructor Documentation

catalog::ClientCatalogManager::ClientCatalogManager ( MountPoint mountpoint)
explicit

Definition at line 38 of file catalog_mgr_client.cc.

Here is the call graph for this function:

catalog::ClientCatalogManager::~ClientCatalogManager ( )
virtual

Definition at line 59 of file catalog_mgr_client.cc.

Here is the call graph for this function:

Member Function Documentation

void catalog::ClientCatalogManager::ActivateCatalog ( catalog::Catalog catalog)
protectedvirtual

Triggered when the catalog is attached (db file opened)

Reimplemented from catalog::AbstractCatalogManager< Catalog >.

Definition at line 29 of file catalog_mgr_client.cc.

Here is the call graph for this function:

uint64_t catalog::ClientCatalogManager::all_inodes ( ) const
inline

Definition at line 72 of file catalog_mgr_client.h.

Referenced by cvmfs::cvmfs_statfs().

Here is the caller graph for this function:

Catalog * catalog::ClientCatalogManager::CreateCatalog ( const PathString mountpoint,
const shash::Any catalog_hash,
catalog::Catalog parent_catalog 
)
protectedvirtual

Create a new Catalog object. Every derived class has to implement this and return a newly created (derived) Catalog structure of it's desired type.

Parameters
mountpointthe future mountpoint of the catalog to create
catalog_hashthe content hash of the catalog database
parent_catalogthe parent of the catalog to create
Returns
a newly created (derived) Catalog

Implements catalog::AbstractCatalogManager< Catalog >.

Definition at line 70 of file catalog_mgr_client.cc.

LoadReturn catalog::ClientCatalogManager::FetchCatalogByHash ( const shash::Any hash,
const std::string &  name,
const std::string &  alt_catalog_path,
std::string *  catalog_path 
)
private

Fetch a catalog by hash either from cache or from remote. Successful load always returns kLoadNew (independent of the location) and sets the sqlite_path variable.

Parameters
[out]sqlite_pathof the catalog if successfully fetched
Returns
kLoadNew on success kLoadNoSpace out of space, no room on the device to open the catalog kLoadFail on all other failures

Definition at line 345 of file catalog_mgr_client.cc.

Referenced by LoadCatalogByHash().

Here is the call graph for this function:

Here is the caller graph for this function:

catalog::ClientCatalogManager::FRIEND_TEST ( T_CatalogManagerClient  ,
MountLatest   
)
private
catalog::ClientCatalogManager::FRIEND_TEST ( T_CatalogManagerClient  ,
LoadByHash   
)
private
catalog::ClientCatalogManager::FRIEND_TEST ( T_CatalogManagerClient  ,
LoadByHashNetworkFailure   
)
private
catalog::ClientCatalogManager::FRIEND_TEST ( T_CatalogManagerClient  ,
LoadRootCatalog   
)
private
std::string catalog::ClientCatalogManager::GetCatalogDescription ( const PathString mountpoint,
const shash::Any hash 
)

Definition at line 270 of file catalog_mgr_client.cc.

Referenced by LoadCatalogByHash(), and StageNestedCatalogByHash().

Here is the call graph for this function:

Here is the caller graph for this function:

LoadReturn catalog::ClientCatalogManager::GetNewRootCatalogContext ( CatalogContext result)
protectedvirtual

Gets information about the most recent root catalog, including even if it is a fixed root catalog. This is needed as Remount() does not know what kind of root catalog will be remounted.

Checks the locations: mounted, alien cache and remote (server) and sets the fields of variable "result". For the most recent catalog the location, hash and revision number are set.

Parameters
[out]resultAll fields but sqlite_path will be set: mountpoint, root_ctl_location, root_ctlg_revision, hash
Returns
kLoadUp2Date - if most recent root catalog is already mounted kLoadNew - otherwise

Implements catalog::AbstractCatalogManager< Catalog >.

Definition at line 130 of file catalog_mgr_client.cc.

Here is the call graph for this function:

shash::Any catalog::ClientCatalogManager::GetRootHash ( )

Definition at line 81 of file catalog_mgr_client.cc.

Referenced by RootHashMagicXattr::PrepareValueFenced().

Here is the call graph for this function:

Here is the caller graph for this function:

bool catalog::ClientCatalogManager::InitFixed ( const shash::Any root_hash,
bool  alternative_path 
)

Specialized initialization that uses a fixed root hash.

Returns
true - root catalog was successfully mounted false - otherwise

Definition at line 95 of file catalog_mgr_client.cc.

Referenced by MountPoint::CreateCatalogManager().

Here is the call graph for this function:

Here is the caller graph for this function:

bool catalog::ClientCatalogManager::IsRevisionBlacklisted ( )

Checks if the current repository revision is blacklisted. The format of the blacklist lines is '<REPO N' where REPO is the repository name, N is the revision number, and the two parts are separated by whitespace. Any revision of REPO less than N is blacklisted. Note: no extra characters are allowed after N, not even whitespace.

Returns
true if it is blacklisted, false otherwise

Definition at line 410 of file catalog_mgr_client.cc.

Referenced by MountPoint::CreateCatalogManager().

Here is the call graph for this function:

Here is the caller graph for this function:

LoadReturn catalog::ClientCatalogManager::LoadCatalogByHash ( CatalogContext ctlg_context)
protectedvirtual

Loads (and fetches) a catalog by hash for a given mountpoint.

Special case for root catalog: ctlg_context->root_ctlg_location must be given.

Parameters
[in,out]ctlg_contextmandatory fields (input): mountpoint, hash additional mandatory fields for root catalog: root_ctlg_location output: sqlite_path is set if catalog fetch successful
Returns
kLoadUp2Date for root catalog that is already mounted kLoadNew for any other successful load kLoadFail on failure

Implements catalog::AbstractCatalogManager< Catalog >.

Definition at line 292 of file catalog_mgr_client.cc.

Here is the call graph for this function:

uint64_t catalog::ClientCatalogManager::loaded_inodes ( ) const
inline

Definition at line 73 of file catalog_mgr_client.h.

Referenced by cvmfs::cvmfs_statfs().

Here is the caller graph for this function:

manifest::Manifest* catalog::ClientCatalogManager::manifest ( ) const
inline

Definition at line 75 of file catalog_mgr_client.h.

Referenced by LoadCatalogByHash(), and RepoMetainfoMagicXattr::PrepareValueFenced().

Here is the call graph for this function:

Here is the caller graph for this function:

bool catalog::ClientCatalogManager::offline_mode ( ) const
inline

Definition at line 71 of file catalog_mgr_client.h.

Referenced by FuseRemounter::Spawn().

Here is the caller graph for this function:

std::string catalog::ClientCatalogManager::repo_name ( ) const
inline

Definition at line 74 of file catalog_mgr_client.h.

Referenced by catalog::CachedManifestEnsemble::FetchCertificate().

Here is the caller graph for this function:

int catalog::ClientCatalogManager::root_fd ( ) const
inline

Definition at line 76 of file catalog_mgr_client.h.

Referenced by RestoreState().

Here is the caller graph for this function:

void catalog::ClientCatalogManager::StageNestedCatalogByHash ( const shash::Any ,
const PathString  
)
protectedvirtual

Opportunistic optimization: the client catalog manager uses this method to preload into the cache a nested catalog that is likely to be required next. Likely, because there is a race with the root catalog reload which may result in the wrong catalog being staged. That's not a fault though, the correct catalog will still be loaded with the write lock held. Note that this method is never used for root catalogs.

Reimplemented from catalog::AbstractCatalogManager< Catalog >.

Definition at line 374 of file catalog_mgr_client.cc.

Here is the call graph for this function:

void catalog::ClientCatalogManager::UnloadCatalog ( const catalog::Catalog catalog)
protectedvirtual

Reimplemented from catalog::AbstractCatalogManager< Catalog >.

Definition at line 388 of file catalog_mgr_client.cc.

Here is the call graph for this function:

Friends And Related Function Documentation

friend class CachedManifestEnsemble
friend

Definition at line 57 of file catalog_mgr_client.h.

Referenced by GetNewRootCatalogContext().

Member Data Documentation

uint64_t catalog::ClientCatalogManager::all_inodes_
private

Definition at line 108 of file catalog_mgr_client.h.

Referenced by all_inodes().

BackoffThrottle catalog::ClientCatalogManager::backoff_throttle_
private

Definition at line 112 of file catalog_mgr_client.h.

cvmfs::Fetcher* catalog::ClientCatalogManager::fetcher_
private
bool catalog::ClientCatalogManager::fixed_alt_root_catalog_
private

fixed root hash but alternative url

Definition at line 111 of file catalog_mgr_client.h.

Referenced by GetNewRootCatalogContext(), InitFixed(), and LoadCatalogByHash().

shash::Any catalog::ClientCatalogManager::fixed_root_catalog_
private

fixed root hash

Definition at line 110 of file catalog_mgr_client.h.

Referenced by GetNewRootCatalogContext(), and InitFixed().

std::map<PathString, shash::Any> catalog::ClientCatalogManager::loaded_catalogs_
private

Required for unpinning

Definition at line 98 of file catalog_mgr_client.h.

Referenced by CreateCatalog(), and LoadCatalogByHash().

uint64_t catalog::ClientCatalogManager::loaded_inodes_
private

Definition at line 109 of file catalog_mgr_client.h.

Referenced by loaded_inodes(), and UnloadCatalog().

UniquePtr<manifest::Manifest> catalog::ClientCatalogManager::manifest_
private

Definition at line 101 of file catalog_mgr_client.h.

Referenced by manifest().

std::map<PathString, shash::Any> catalog::ClientCatalogManager::mounted_catalogs_
private
perf::Counter* catalog::ClientCatalogManager::n_certificate_hits_
private
perf::Counter* catalog::ClientCatalogManager::n_certificate_misses_
private
bool catalog::ClientCatalogManager::offline_mode_
private

cached copy used because there is no network

Definition at line 107 of file catalog_mgr_client.h.

Referenced by GetNewRootCatalogContext(), and offline_mode().

std::string catalog::ClientCatalogManager::repo_name_
private
int catalog::ClientCatalogManager::root_fd_
private

File descriptor of first loaded catalog; used for mapping the root catalog file descriptor when restoring the cache manager after a fuse module reload

Definition at line 120 of file catalog_mgr_client.h.

Referenced by FetchCatalogByHash(), and root_fd().

signature::SignatureManager* catalog::ClientCatalogManager::signature_mgr_
private

Definition at line 105 of file catalog_mgr_client.h.

Referenced by GetNewRootCatalogContext(), and IsRevisionBlacklisted().

std::string catalog::ClientCatalogManager::workspace_
private

Definition at line 106 of file catalog_mgr_client.h.


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