5 #ifndef CVMFS_CATALOG_MGR_H_
6 #define CVMFS_CATALOG_MGR_H_
8 #ifndef __STDC_FORMAT_MACROS
9 #define __STDC_FORMAT_MACROS
166 texts[0] =
"loaded new catalog";
167 texts[1] =
"catalog was up to date";
168 texts[2] =
"not enough space to load catalog";
169 texts[3] =
"failed to load catalog";
170 texts[4] =
"no text";
190 "Number of inode lookups");
192 "Number of path lookups");
194 "catalog_mgr.n_lookup_path_negative",
195 "Number of negative path lookups");
197 "Number of xattrs lookups");
199 "Number of listings");
201 "Number of listings of nested catalogs");
203 "Number of times the CVMFS_CATALOG_WATERMARK was hit");
205 "number of write lock calls");
207 "time spent in WriteLock() [ns]");
209 "Revision number of the root file catalog");
214 template <
class CatalogT>
215 class AbstractCatalogManager;
234 template <
class CatalogT>
235 class AbstractCatalogManager :
public SingleCopy {
257 p.
Assign(&path[0], path.length());
267 std::vector<PathString> *result_list);
270 const bool expand_symlink);
272 return Listing(path, listing,
true);
276 p.
Assign(&path[0], path.length());
324 std::string *subcatalog_path,
361 const CatalogT *parent,
375 CatalogT *parent_catalog) = 0;
378 CatalogT *parent_catalog);
380 const CatalogT *entry_point,
382 CatalogT **leaf_catalog);
387 bool AttachCatalog(
const std::string &db_path, CatalogT *new_catalog);
393 CatalogT **attached_catalog)
const;
400 int retval = pthread_rwlock_rdlock(
rwlock_);
405 int retval = pthread_rwlock_wrlock(
rwlock_);
412 int retval = pthread_rwlock_unlock(
rwlock_);
462 const int level)
const;
512 return annotated_inode;
532 #endif // CVMFS_CATALOG_MGR_H_
void DetachSubtree(CatalogT *catalog)
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_
int64_t Xadd(class Counter *counter, const int64_t delta)
Statistics(perf::Statistics *statistics)
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
void StageNestedCatalogAndUnlock(const PathString &path, const CatalogT *parent, bool is_listable)
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_
RootCatalogLocation root_ctlg_location_
void Assign(const char *chars, const unsigned length)
std::string PrintHierarchyRecursively(const CatalogT *catalog, const int level) const
shash::Any * GetHashPtr()
RootCatalogLocation root_ctlg_location() const
perf::Counter * n_nested_listing
uint64_t GetTimestamp() const
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)
uint64_t root_ctlg_revision_
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_
std::string sqlite_path() const
perf::Counter * n_lookup_path_negative
manifest::ManifestEnsemble * manifest_ensemble() const
virtual LoadReturn GetNewRootCatalogContext(CatalogContext *result)=0
bool Listing(const PathString &path, DirectoryEntryList *listing, const bool expand_symlink)
void SetMountpoint(const PathString &mountpoint)
perf::Counter * n_detach_siblings
virtual void UnloadCatalog(const CatalogT *catalog)
std::vector< DirectoryEntry > DirectoryEntryList
void TakeManifestEnsemble(manifest::ManifestEnsemble *manifest_ensemble)
bool AttachCatalog(const std::string &db_path, CatalogT *new_catalog)
LoadReturn ChangeRoot(const shash::Any &root_hash)
const unsigned kSqliteMemPerThread
uint64_t GetTimestampNoLock() const
static const uint64_t kRootInode
CatalogContext(const shash::Any &hash, const PathString &mountpoint)
virtual bool ValidInode(const uint64_t inode)
LoadReturn RemountDryrun()
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
UniquePtr< manifest::ManifestEnsemble > manifest_ensemble_
perf::Counter * n_write_lock
virtual void StageNestedCatalogByHash(const shash::Any &, const PathString &)
void CheckInodeWatermark()
void Inc(class Counter *counter)
std::vector< CatalogT * > CatalogList
const unsigned kLookupRawSymlink
uint64_t root_ctlg_revision() const
void SetRootCtlgLocation(RootCatalogLocation root_ctlg_location)
bool ListCatalogSkein(const PathString &path, std::vector< PathString > *result_list)
InodeRange AcquireInodes(uint64_t size)
CatalogT * GetRootCatalog() const
pthread_rwlock_t * rwlock_
std::string * GetSqlitePathPtr()
uint64_t GetRevision() const
uint64_t GetRevisionNoLock() 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 * ns_write_lock
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()
const char * Code2Ascii(const LoadReturn error)
uint64_t timestamp_cache_
virtual void IncGeneration(const uint64_t by)
bool LookupXattrs(const PathString &path, XattrList *xattrs)
PathString mountpoint() const
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)
CatalogContext(const shash::Any &hash, const PathString &mountpoint, const RootCatalogLocation location)
virtual void ActivateCatalog(CatalogT *catalog)
void SetHash(shash::Any hash)
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
void SetSqlitePath(const std::string &sqlite_path)
InodeNfsGenerationAnnotation()
static const inode_t kInodeOffset
virtual LoadReturn LoadCatalogByHash(CatalogContext *ctlg_context)=0
void SetInodeAnnotation(InodeAnnotation *new_annotation)
void SetRootCtlgRevision(uint64_t root_ctlg_revision)
CVMFS_EXPORT void LogCvmfs(const LogSource source, const int mask, const char *format,...)