CernVM-FS
2.12.0
|
#include <catalog_mgr_client.h>
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::Manifest * | manifest () 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 |
Catalog * | GetRootCatalog () 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::Catalog * | CreateCatalog (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) |
Catalog * | MountCatalog (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) |
Catalog * | LoadFreeCatalog (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 ¤t_tree) |
void | DetachAll () |
bool | IsAttached (const PathString &root_path, Catalog **attached_catalog) const |
Catalog * | FindCatalog (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::Any > | loaded_catalogs_ |
std::map< PathString, shash::Any > | mounted_catalogs_ |
UniquePtr< manifest::Manifest > | manifest_ |
std::string | repo_name_ |
cvmfs::Fetcher * | fetcher_ |
signature::SignatureManager * | signature_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::Counter * | n_certificate_hits_ |
perf::Counter * | n_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 |
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.
|
explicit |
|
virtual |
|
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.
|
inline |
Definition at line 72 of file catalog_mgr_client.h.
Referenced by cvmfs::cvmfs_statfs().
|
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.
mountpoint | the future mountpoint of the catalog to create |
catalog_hash | the content hash of the catalog database |
parent_catalog | the parent of the catalog to create |
Implements catalog::AbstractCatalogManager< Catalog >.
Definition at line 70 of file catalog_mgr_client.cc.
|
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.
[out] | sqlite_path | of the catalog if successfully fetched |
Definition at line 345 of file catalog_mgr_client.cc.
Referenced by LoadCatalogByHash().
|
private |
|
private |
|
private |
|
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().
|
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.
[out] | result | All fields but sqlite_path will be set: mountpoint, root_ctl_location, root_ctlg_revision, hash |
Implements catalog::AbstractCatalogManager< Catalog >.
Definition at line 130 of file catalog_mgr_client.cc.
shash::Any catalog::ClientCatalogManager::GetRootHash | ( | ) |
Definition at line 81 of file catalog_mgr_client.cc.
Referenced by RootHashMagicXattr::PrepareValueFenced().
bool catalog::ClientCatalogManager::InitFixed | ( | const shash::Any & | root_hash, |
bool | alternative_path | ||
) |
Specialized initialization that uses a fixed root hash.
Definition at line 95 of file catalog_mgr_client.cc.
Referenced by MountPoint::CreateCatalogManager().
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.
Definition at line 410 of file catalog_mgr_client.cc.
Referenced by MountPoint::CreateCatalogManager().
|
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.
[in,out] | ctlg_context | mandatory fields (input): mountpoint, hash additional mandatory fields for root catalog: root_ctlg_location output: sqlite_path is set if catalog fetch successful |
Implements catalog::AbstractCatalogManager< Catalog >.
Definition at line 292 of file catalog_mgr_client.cc.
|
inline |
Definition at line 73 of file catalog_mgr_client.h.
Referenced by cvmfs::cvmfs_statfs().
|
inline |
Definition at line 75 of file catalog_mgr_client.h.
Referenced by LoadCatalogByHash(), and RepoMetainfoMagicXattr::PrepareValueFenced().
|
inline |
Definition at line 71 of file catalog_mgr_client.h.
Referenced by FuseRemounter::Spawn().
|
inline |
Definition at line 74 of file catalog_mgr_client.h.
Referenced by catalog::CachedManifestEnsemble::FetchCertificate().
|
inline |
Definition at line 76 of file catalog_mgr_client.h.
Referenced by RestoreState().
|
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.
|
protectedvirtual |
Reimplemented from catalog::AbstractCatalogManager< Catalog >.
Definition at line 388 of file catalog_mgr_client.cc.
|
friend |
Definition at line 57 of file catalog_mgr_client.h.
Referenced by GetNewRootCatalogContext().
|
private |
Definition at line 108 of file catalog_mgr_client.h.
Referenced by all_inodes().
|
private |
Definition at line 112 of file catalog_mgr_client.h.
|
private |
Definition at line 104 of file catalog_mgr_client.h.
Referenced by FetchCatalogByHash(), GetNewRootCatalogContext(), LoadCatalogByHash(), StageNestedCatalogByHash(), UnloadCatalog(), and ~ClientCatalogManager().
|
private |
fixed root hash but alternative url
Definition at line 111 of file catalog_mgr_client.h.
Referenced by GetNewRootCatalogContext(), InitFixed(), and LoadCatalogByHash().
|
private |
fixed root hash
Definition at line 110 of file catalog_mgr_client.h.
Referenced by GetNewRootCatalogContext(), and InitFixed().
|
private |
Required for unpinning
Definition at line 98 of file catalog_mgr_client.h.
Referenced by CreateCatalog(), and LoadCatalogByHash().
|
private |
Definition at line 109 of file catalog_mgr_client.h.
Referenced by loaded_inodes(), and UnloadCatalog().
|
private |
Definition at line 101 of file catalog_mgr_client.h.
Referenced by manifest().
|
private |
Definition at line 99 of file catalog_mgr_client.h.
Referenced by CreateCatalog(), GetNewRootCatalogContext(), GetRootHash(), UnloadCatalog(), and ~ClientCatalogManager().
|
private |
Definition at line 113 of file catalog_mgr_client.h.
Referenced by ClientCatalogManager(), and catalog::CachedManifestEnsemble::FetchCertificate().
|
private |
Definition at line 114 of file catalog_mgr_client.h.
Referenced by ClientCatalogManager(), and catalog::CachedManifestEnsemble::FetchCertificate().
|
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().
|
private |
Definition at line 103 of file catalog_mgr_client.h.
Referenced by GetCatalogDescription(), GetNewRootCatalogContext(), IsRevisionBlacklisted(), LoadCatalogByHash(), and repo_name().
|
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().
|
private |
Definition at line 105 of file catalog_mgr_client.h.
Referenced by GetNewRootCatalogContext(), and IsRevisionBlacklisted().
|
private |
Definition at line 106 of file catalog_mgr_client.h.