5 #ifndef CVMFS_CATALOG_MGR_H_
6 #define CVMFS_CATALOG_MGR_H_
8 #ifndef __STDC_FORMAT_MACROS
9 #define __STDC_FORMAT_MACROS
58 texts[0] =
"loaded new catalog";
59 texts[1] =
"catalog was up to date";
60 texts[2] =
"not enough space to load catalog";
61 texts[3] =
"failed to load catalog";
79 "Number of inode lookups");
81 "Number of path lookups");
83 "catalog_mgr.n_lookup_path_negative",
84 "Number of negative path lookups");
86 "Number of xattrs lookups");
88 "Number of listings");
90 "Number of listings of nested catalogs");
92 "Number of times the CVMFS_CATALOG_WATERMARK was hit");
94 "Revision number of the root file catalog");
99 template <
class CatalogT>
100 class AbstractCatalogManager;
119 template <
class CatalogT>
120 class AbstractCatalogManager :
public SingleCopy {
141 p.
Assign(&path[0], path.length());
151 std::vector<PathString> *result_list);
154 const bool expand_symlink);
156 return Listing(path, listing,
true);
160 p.
Assign(&path[0], path.length());
207 std::string *subcatalog_path,
218 std::string *catalog_path,
235 CatalogT *parent_catalog) = 0;
238 CatalogT *parent_catalog);
240 const CatalogT *entry_point,
242 CatalogT **leaf_catalog);
247 bool AttachCatalog(
const std::string &db_path, CatalogT *new_catalog);
253 CatalogT **attached_catalog)
const;
258 int retval = pthread_rwlock_rdlock(
rwlock_);
262 int retval = pthread_rwlock_wrlock(
rwlock_);
266 int retval = pthread_rwlock_unlock(
rwlock_);
315 const int level)
const;
365 return annotated_inode;
385 #endif // CVMFS_CATALOG_MGR_H_
LoadError ChangeRoot(const shash::Any &root_hash)
void DetachSubtree(CatalogT *catalog)
#define LogCvmfs(source, mask,...)
bool Listing(const std::string &path, DirectoryEntryList *listing)
bool GetVOMSAuthz(std::string *authz) const
Counter * Register(const std::string &name, const std::string &desc)
virtual inode_t GetGeneration()
catalog::Counters LookupCounters(const PathString &path, std::string *subcatalog_path, shash::Any *hash)
pthread_key_t pkey_sqlitemem_
Statistics(perf::Statistics *statistics)
const char * Code2Ascii(const LoadError error)
virtual ~AbstractCatalogManager()
const std::vector< CatalogT * > & GetCatalogs() const
virtual void EnforceSqliteMemLimit()
virtual inode_t Annotate(const inode_t raw_inode)
CatalogT * LoadFreeCatalog(const PathString &mountpoint, const shash::Any &hash)
bool HasExplicitTTL() const
perf::Counter * n_lookup_inode
perf::Counter * catalog_revision
bool MountSubtree(const PathString &path, const CatalogT *entry_point, bool can_listing, CatalogT **leaf_catalog)
bool volatile_flag() const
void DetachSiblings(const PathString ¤t_tree)
virtual inode_t Annotate(const inode_t raw_inode)
InodeAnnotation * inode_annotation_
void Assign(const char *chars, const unsigned length)
std::string PrintHierarchyRecursively(const CatalogT *catalog, const int level) const
perf::Counter * n_nested_listing
void DetachCatalog(CatalogT *catalog)
bool IsAttached(const PathString &root_path, CatalogT **attached_catalog) const
virtual inode_t Strip(const inode_t annotated_inode)
virtual inode_t GetGeneration()
assert((mem||(size==0))&&"Out Of Memory")
bool ListingStat(const PathString &path, StatEntryList *listing)
bool LookupPath(const PathString &path, const LookupOptions options, DirectoryEntry *entry)
virtual inode_t Strip(const inode_t annotated_inode)
InodeGenerationAnnotation()
const unsigned kLookupDefault
bool Listing(const PathString &path, DirectoryEntryList *listing)
IntegerMap< uint64_t > OwnerMap
unsigned catalog_watermark_
perf::Counter * n_lookup_path_negative
LoadError Remount(const bool dry_run)
bool Listing(const PathString &path, DirectoryEntryList *listing, const bool expand_symlink)
perf::Counter * n_detach_siblings
virtual void UnloadCatalog(const CatalogT *catalog)
std::vector< DirectoryEntry > DirectoryEntryList
bool AttachCatalog(const std::string &db_path, CatalogT *new_catalog)
const unsigned kSqliteMemPerThread
static const uint64_t kRootInode
virtual bool ValidInode(const uint64_t inode)
shash::Any GetNestedCatalogHash(const PathString &mountpoint)
Statistics statistics() const
virtual CatalogT * CreateCatalog(const PathString &mountpoint, const shash::Any &catalog_hash, CatalogT *parent_catalog)=0
perf::Counter * n_listing
void CheckInodeWatermark()
std::vector< CatalogT * > CatalogList
const unsigned kLookupRawSymlink
bool ListCatalogSkein(const PathString &path, std::vector< PathString > *result_list)
InodeRange AcquireInodes(uint64_t size)
CatalogT * GetRootCatalog() const
virtual LoadError LoadCatalog(const PathString &mountpoint, const shash::Any &hash, std::string *catalog_path, shash::Any *catalog_hash)=0
pthread_rwlock_t * rwlock_
uint64_t GetRevision() const
bool LookupPath(const std::string &path, const LookupOptions options, DirectoryEntry *entry)
int GetNumCatalogs() const
bool ListFileChunks(const PathString &path, const shash::Algorithms interpret_hashes_as, FileChunkList *chunks)
perf::Counter * n_lookup_xattrs
virtual bool ValidInode(const uint64_t inode)
virtual inode_t Annotate(const inode_t raw_inode)=0
virtual void IncGeneration(const uint64_t by)
perf::Counter * n_lookup_path
virtual ~InodeNfsGenerationAnnotation()
virtual void IncGeneration(const uint64_t by)
bool LookupXattrs(const PathString &path, XattrList *xattrs)
bool LookupNested(const PathString &path, PathString *mountpoint, shash::Any *hash, uint64_t *size)
CatalogT * MountCatalog(const PathString &mountpoint, const shash::Any &hash, CatalogT *parent_catalog)
void SetCatalogWatermark(unsigned limit)
virtual void ActivateCatalog(CatalogT *catalog)
void SetOwnerMaps(const OwnerMap &uid_map, const OwnerMap &gid_map)
inode_t GetRootInode() const
void ReleaseInodes(const InodeRange chunk)
CatalogT * FindCatalog(const PathString &path) const
inode_t MangleInode(const inode_t inode) const
AbstractCatalogManager(perf::Statistics *statistics)
virtual ~InodeGenerationAnnotation()
int inode_watermark_status_
std::string PrintHierarchy() const
std::string PrintMemStatsRecursively(const CatalogT *catalog) const
std::string PrintAllMemStatistics() const
InodeNfsGenerationAnnotation()
static const inode_t kInodeOffset
void SetInodeAnnotation(InodeAnnotation *new_annotation)