![]() |
CernVM-FS
2.11.0
|
#include <cache_posix.h>
Classes | |
struct | Transaction |
Public Types | |
enum | CacheModes { kCacheReadWrite = 0, kCacheReadOnly } |
enum | RenameWorkarounds { kRenameNormal = 0, kRenameLink, kRenameSamedir } |
![]() | |
enum | ObjectType { kTypeRegular = 0, kTypeCatalog, kTypePinned, kTypeVolatile } |
Public Member Functions | |
virtual CacheManagerIds | id () |
virtual std::string | Describe () |
virtual | ~PosixCacheManager () |
virtual bool | AcquireQuotaManager (QuotaManager *quota_mgr) |
virtual int | Open (const BlessedObject &object) |
virtual int64_t | GetSize (int fd) |
virtual int | Close (int fd) |
virtual int64_t | Pread (int fd, void *buf, uint64_t size, uint64_t offset) |
virtual int | Dup (int fd) |
virtual int | Readahead (int fd) |
virtual uint32_t | SizeOfTxn () |
virtual int | StartTxn (const shash::Any &id, uint64_t size, void *txn) |
virtual void | CtrlTxn (const ObjectInfo &object_info, const int flags, void *txn) |
virtual int64_t | Write (const void *buf, uint64_t size, void *txn) |
virtual int | Reset (void *txn) |
virtual int | OpenFromTxn (void *txn) |
virtual int | AbortTxn (void *txn) |
virtual int | CommitTxn (void *txn) |
virtual void | Spawn () |
virtual manifest::Breadcrumb | LoadBreadcrumb (const std::string &fqrn) |
virtual bool | StoreBreadcrumb (const manifest::Manifest &manifest) |
bool | StoreBreadcrumb (std::string fqrn, manifest::Breadcrumb breadcrumb) |
void | TearDown2ReadOnly () |
CacheModes | cache_mode () |
bool | alien_cache () |
std::string | cache_path () |
![]() | |
virtual | ~CacheManager () |
int | OpenPinned (const shash::Any &id, const std::string &description, bool is_catalog) |
int | ChecksumFd (int fd, shash::Any *id) |
bool | Open2Mem (const shash::Any &id, const std::string &description, unsigned char **buffer, uint64_t *size) |
bool | CommitFromMem (const shash::Any &id, const unsigned char *buffer, const uint64_t size, const std::string &description) |
QuotaManager * | quota_mgr () |
void * | SaveState (const int fd_progress) |
int | RestoreState (const int fd_progress, void *state) |
void | FreeState (const int fd_progress, void *state) |
Static Public Member Functions | |
static PosixCacheManager * | Create (const std::string &cache_path, const bool alien_cache, const RenameWorkarounds rename_workaround=kRenameNormal) |
![]() | |
static BlessedObject | Bless (const shash::Any &id) |
static BlessedObject | Bless (const shash::Any &id, const ObjectInfo &info) |
static BlessedObject | Bless (const shash::Any &id, ObjectType type) |
static BlessedObject | Bless (const shash::Any &id, const std::string &description) |
static BlessedObject | Bless (const shash::Any &id, ObjectType type, const std::string &description) |
Static Public Attributes | |
static const uint64_t | kBigFile = 25 * 1024 * 1024 |
![]() | |
static const uint64_t | kSizeUnknown = uint64_t(-1) |
Protected Member Functions | |
virtual void * | DoSaveState () |
virtual int | DoRestoreState (void *data) |
virtual bool | DoFreeState (void *data) |
![]() | |
CacheManager () | |
Private Member Functions | |
FRIEND_TEST (T_CacheManager, CommitTxnQuotaNotifications) | |
FRIEND_TEST (T_CacheManager, CommitTxnRenameFail) | |
FRIEND_TEST (T_CacheManager, Open) | |
FRIEND_TEST (T_CacheManager, OpenFromTxn) | |
FRIEND_TEST (T_CacheManager, OpenPinned) | |
FRIEND_TEST (T_CacheManager, Rename) | |
FRIEND_TEST (T_CacheManager, StartTxn) | |
FRIEND_TEST (T_CacheManager, TearDown2ReadOnly) | |
PosixCacheManager (const std::string &cache_path, const bool alien_cache) | |
std::string | GetPathInCache (const shash::Any &id) |
int | Rename (const char *oldpath, const char *newpath) |
int | Flush (Transaction *transaction) |
Private Attributes | |
std::string | cache_path_ |
std::string | txn_template_path_ |
bool | alien_cache_ |
RenameWorkarounds | rename_workaround_ |
CacheModes | cache_mode_ |
atomic_int32 | no_inflight_txns_ |
bool | reports_correct_filesize_ |
Additional Inherited Members | |
![]() | |
QuotaManager * | quota_mgr_ |
Cache manager implementation using a file system (cache directory) as a backing storage.
Definition at line 39 of file cache_posix.h.
Enumerator | |
---|---|
kCacheReadWrite | |
kCacheReadOnly |
Definition at line 50 of file cache_posix.h.
Enumerator | |
---|---|
kRenameNormal | |
kRenameLink | |
kRenameSamedir |
Definition at line 55 of file cache_posix.h.
|
inlinevirtual |
Definition at line 75 of file cache_posix.h.
|
inlineprivate |
Definition at line 136 of file cache_posix.h.
|
virtual |
Implements CacheManager.
Definition at line 113 of file cache_posix.cc.
Referenced by anonymous_namespace{cvmfs_cache_posix.cc}::posix_abort_txn(), and anonymous_namespace{cvmfs_cache_posix.cc}::posix_commit_txn().
|
virtual |
This should only be used to replace the default NoopQuotaManager by a PosixQuotaManager. The cache manager takes the ownership of the passed quota manager.
Implements CacheManager.
Definition at line 131 of file cache_posix.cc.
|
inline |
Definition at line 104 of file cache_posix.h.
Referenced by FileSystem::SetupNfsMaps().
|
inline |
Definition at line 103 of file cache_posix.h.
Referenced by TalkManager::MainResponder().
|
inline |
Definition at line 105 of file cache_posix.h.
Referenced by FileSystem::SetupNfsMaps().
|
virtual |
Implements CacheManager.
Definition at line 140 of file cache_posix.cc.
Referenced by anonymous_namespace{cvmfs_cache_posix.cc}::posix_chrefcnt().
|
virtual |
Implements CacheManager.
Definition at line 148 of file cache_posix.cc.
Referenced by anonymous_namespace{cvmfs_cache_posix.cc}::posix_commit_txn().
|
static |
Definition at line 230 of file cache_posix.cc.
Referenced by main(), and FileSystem::SetupPosixCacheMgr().
|
virtual |
Implements CacheManager.
Definition at line 277 of file cache_posix.cc.
Referenced by anonymous_namespace{cvmfs_cache_posix.cc}::posix_start_txn().
|
virtual |
Return a human readable description of the cache instance. Used in cvmfs_talk.
Implements CacheManager.
Definition at line 287 of file cache_posix.cc.
|
protectedvirtual |
Reimplemented from CacheManager.
Definition at line 311 of file cache_posix.cc.
|
protectedvirtual |
Reimplemented from CacheManager.
Definition at line 303 of file cache_posix.cc.
|
protectedvirtual |
Nothing to do, the kernel keeps the state of open file descriptors. Return a dummy memory location.
Reimplemented from CacheManager.
Definition at line 296 of file cache_posix.cc.
|
virtual |
Implements CacheManager.
Definition at line 318 of file cache_posix.cc.
|
private |
Definition at line 326 of file cache_posix.cc.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
inlineprivate |
Definition at line 342 of file cache_posix.cc.
|
virtual |
Implements CacheManager.
Definition at line 347 of file cache_posix.cc.
Referenced by anonymous_namespace{cvmfs_cache_posix.cc}::posix_chrefcnt(), and anonymous_namespace{cvmfs_cache_posix.cc}::posix_commit_txn().
|
inlinevirtual |
Implements CacheManager.
Definition at line 68 of file cache_posix.h.
|
virtual |
While not strictly necessary, cache managers often have a directory associated with them. This directory is currently used to find the cached manifest copy, the cvmfschecksum.$reponame file. This is important to make pre-loaded alien caches work, even in a tiered setup.
Reimplemented from CacheManager.
Definition at line 523 of file cache_posix.cc.
Referenced by anonymous_namespace{cvmfs_cache_posix.cc}::posix_breadcrumb_load().
|
virtual |
Opening an object might get it from a third-party source, e.g. when the tiered cache manager issues a copy-up operation. In this case it is beneficial to register the object with the accurate meta-data, in the same way it is done during transactions.
Implements CacheManager.
Definition at line 356 of file cache_posix.cc.
Referenced by anonymous_namespace{cvmfs_cache_posix.cc}::posix_chrefcnt().
|
virtual |
Implements CacheManager.
Definition at line 372 of file cache_posix.cc.
Referenced by anonymous_namespace{cvmfs_cache_posix.cc}::posix_commit_txn().
|
virtual |
Implements CacheManager.
Definition at line 384 of file cache_posix.cc.
Referenced by anonymous_namespace{cvmfs_cache_posix.cc}::posix_pread().
|
virtual |
Used by the sqlite vfs in order to preload file catalogs into the file system buffers.
Implements CacheManager.
Definition at line 429 of file cache_posix.cc.
|
private |
Definition at line 401 of file cache_posix.cc.
|
virtual |
Implements CacheManager.
Definition at line 444 of file cache_posix.cc.
|
inlinevirtual |
Implements CacheManager.
Definition at line 85 of file cache_posix.h.
Referenced by anonymous_namespace{cvmfs_cache_posix.cc}::posix_start_txn().
|
inlinevirtual |
Implements CacheManager.
Definition at line 96 of file cache_posix.h.
|
virtual |
Implements CacheManager.
Definition at line 458 of file cache_posix.cc.
Referenced by anonymous_namespace{cvmfs_cache_posix.cc}::posix_start_txn().
|
virtual |
Reimplemented from CacheManager.
Definition at line 529 of file cache_posix.cc.
Referenced by anonymous_namespace{cvmfs_cache_posix.cc}::posix_breadcrumb_store().
bool PosixCacheManager::StoreBreadcrumb | ( | std::string | fqrn, |
manifest::Breadcrumb | breadcrumb | ||
) |
void PosixCacheManager::TearDown2ReadOnly | ( | ) |
Definition at line 540 of file cache_posix.cc.
Referenced by FileSystem::TearDown2ReadOnly().
|
virtual |
Implements CacheManager.
Definition at line 551 of file cache_posix.cc.
Referenced by anonymous_namespace{cvmfs_cache_posix.cc}::posix_write_txn().
|
private |
Definition at line 153 of file cache_posix.h.
Referenced by alien_cache(), and Create().
|
private |
Definition at line 155 of file cache_posix.h.
Referenced by cache_mode().
|
private |
Definition at line 151 of file cache_posix.h.
Referenced by cache_path().
|
static |
As of 25M, a file is considered a "big file", which means it is dangerous to apply asynchronous semantics. On start of a transaction with a big file the cache is cleaned up opportunistically.
Definition at line 66 of file cache_posix.h.
|
private |
The cache can only degrade to a read-only cache once all writable file descriptors from transactions are closed. This is indicated by a zero value in this variable.
Definition at line 162 of file cache_posix.h.
Referenced by PosixCacheManager().
|
private |
Definition at line 154 of file cache_posix.h.
Referenced by Create().
|
private |
Hack for HDFS which writes file sizes asynchronously.
Definition at line 167 of file cache_posix.h.
|
private |
Definition at line 152 of file cache_posix.h.